Browse Source

stuff not needed

master
Steve Saldivar 11 years ago
parent
commit
20e523ac28
  1. 50
      License.md
  2. 2
      README.md
  3. 21
      lib/dashboard/404.html
  4. 191
      lib/dashboard/css/dashboard.css
  5. 208
      lib/dashboard/css/jquery.mCustomScrollbar.css
  6. 85
      lib/dashboard/dashboard.html
  7. 175
      lib/dashboard/dashboard.js
  8. BIN
      lib/dashboard/images/archonbot.png
  9. BIN
      lib/dashboard/images/background.jpg
  10. BIN
      lib/dashboard/images/icons.png
  11. 0
      lib/dashboard/images/transparent_pxl_white-90.png
  12. BIN
      lib/dashboard/images/vector-web-icons.png
  13. 167
      lib/dashboard/js/actions.js
  14. 874
      lib/dashboard/js/jquery.mCustomScrollbar.js
  15. 12
      lib/dashboard/js/jquery.mousewheel.min.js
  16. BIN
      lib/dashboard/webfonts/22AE77_0_0.eot
  17. 3
      lib/dashboard/webfonts/22AE77_0_0.ttf
  18. 3
      lib/dashboard/webfonts/22AE77_0_0.woff
  19. BIN
      lib/dashboard/webfonts/scoolar_tfb.eot
  20. BIN
      lib/dashboard/webfonts/scoolar_tfb.ttf

50
License.md

@ -1,50 +0,0 @@
Software license for LoyaltyBot
===============================
SUMMARY
-------
- Can be used on unlimited sites, servers
- Source-code cannot be resold
- Non-commercial use only
- Can modify source-code and distribute modifications (derivative works) authorized 3rd Parties
- Any code deemed awesome across any fork will be merged into the main branch
TERMS AND CONDITIONS
--------------------
1. **Preamble:** This Agreement, signed on Feb 20, 2013 [hereinafter: Effective Date] governs the relationship between User, a private person, (hereinafter: Licensee) and LoyaltyBot, a private person whose principal place of business is CA, United States (Hereinafter: Licensor). This Agreement sets the terms, rights, restrictions and obligations on using [LoyaltyBot] (hereinafter: The Software) created and owned by Licensor, as detailed herein
2. **License Grant:** Licensor hereby grants Licensee a Personal, Non-assignable & non-transferable, Non-commercial, Including the rights to distribute derivative works, Non-exclusive license, all with accordance with the terms set forth and other legal restrictions set forth in 3rd party software used while running Software
* 2.1. **Limited:** Licensee may use Software for the purpose of:
- 2.1.1. Running Software on Licensee's Website[s] and Server[s];
- 2.1.2. Allowing authorized 3rd Parties to run Software on Licensee's Website[s] and Server[s];
- 2.1.3. Publishing Software's output to Licensee and authorized 3rd Parties;
- 2.1.4. Distribute verbatim copies of Software's output (including compiled binaries) to authorized 3rd Parties;
- 2.1.5. Modify Software to suit Licensee's needs and specifications.
* 2.2. **Non Assignable & Non-Transferable:** Licensee may not assign or transfer his rights and duties under this license.
* 2.3. **Non-Commercial:** Licensee may not use Software for commercial purposes. for the purpose of this license, commercial purposes means that a 3rd party has to pay in order to access Software or that the Website that runs Software is behind a paywall.
* 2.4. **Including the Right to Create Derivative Works:** Licensee may create derivative works based on Software, including amending Software's source code, modifying it, integrating it into a larger work or removing portions of Software, as long as no distribution of the derivative works is made
* 2.5. **Including the right to Distribute Derivative Works:** Licensee may create and distribute derivative works based on Software, including amending Software's source code, modifying it, integrating it into a larger work or removing portions of Software, as long as credit to the Licensor is granted and that redistribution is made under the terms of this license.
* 2.6. **[Multi-]Site:** Licensee may use Software on unlimited server[s] and unlimited website[s], for Licensee's websites only
3. **Term & Termination:** The Term of this license shall be until terminated. Licensor may terminate this Agreement, including Licensee's license in the case where Licensee :
* 3.1. became insolvent or otherwise entered into any liquidation process; or
* 3.2. exported The Software to any jurisdiction where licensor may not enforce his rights under this agreements in; or
* 3.3. Licenee was in breach of any of this license's terms and conditions and such breach was not cured, immediately upon notification; or
* 3.4. Licensee in breach of any of the terms of clause 2 to this license; or
* 3.5. Licensee otherwise entered into any arrangement which caused Licensor to be unable to enforce his rights under this License.
4. **Payment:** In consideration of the License granted under clause 2, Licensee may be required to pay the Licensor, via PayPal or any other mean which Licensor may deem adequate. Failure to perform payment shall construe as material breach of this Agreement.
5. **Upgrades, Updates and Fixes:** Licensor may provide Licensee, from time to time, with Upgrades, Updates or Fixes, as detailed herein and according to his sole discretion. Licensee hereby warrants to keep The Software up-to-date and install all relevant updates and fixes, and may, at his sole discretion, purchase upgrades, according to the rates set by Licensor. Licensor shall provide any update or Fix free of charge; however, nothing in this Agreement shall require Licensor to provide Updates or Fixes.
* 5.1. **Upgrades:** for the purpose of this license, an Upgrade shall be a material amendment in The Software, which contains new features and or major performance improvements which can and will be pulled from any of the given forks into the main code branch. For example, should Licensee make an upgrade that is beneficial to the main code branch, the Licensor reserves the right to merge the Licensee's ugraded code into the main branch.
* 5.2. **Updates:** for the purpose of this license, an update shall be a minor amendment in The Software, which may contain new features or minor improvements. For example, should Licensee make an update that is beneficial to the main code branch, the Licensor reserves the right to merge the Licensee's update into the main code branch.
* 5.3. **Fix:** for the purpose of this license, a fix shall be a minor amendment in The Software, intended to remove bugs or alter minor features which impair the The Software's functionality. For example, should Licensee make fix that is beneficial to the main code branch, the Licensor reserves the right to merge the Licensee's fix into the main code branch.
6. **Support:** Software is provided under an AS-IS basis and without any support, updates or maintenance. Nothing in this Agreement shall require Licensor to provide Licensee with support or fixes to any bug, failure, mis-performance or other defect in The Software.
* 6.1. **Bug Notification:** Licensee may provide Licensor of details regarding any bug, defect or failure in The Software promptly and with no delay from such event; Licensee shall comply with Licensor's request for information regarding bugs, defects or failures and furnish him with information, screenshots and try to reproduce such bugs, defects or failures.
* 6.2. **Feature Request:** Licensee may request additional features in Software, provided, however, that (i) Licesee shall waive any claim or right in such feature should feature be developed by Licensor; (ii) Licensee shall be prohibited from developing the feature, or disclose such feature request, or feature, to any 3rd party directly competing with Licensor or any 3rd party which may be, following the development of such feature, in direct competition with Licensor; (iii) Licensee warrants that feature does not infringe any 3rd party patent, trademark, trade-secret or any other intellectual property right; and (iv) Licensee developed, envisioned or created the feature solely by himself.
7. **Liability:** To the extent permitted under Law, The Software is provided under an AS-IS basis. Licensor shall never, and without any limit, be liable for any damage, cost, expense or any other payment incurred by Licesee as a result of Software's actions, failure, bugs and/or any other interaction between The Software and Licesee's end-equipment, computers, other software or any 3rd party, end-equipment, computer or services. Moreover, Licensor shall never be liable for any defect in source code written by Licensee when relying on The Software or using The Software's source code.
8. **Warranty:**
* 8.1. **Intellectual Property:** Licensor hereby warrants that The Software does not violate or infringe any 3rd party claims in regards to intellectual property, patents and/or trademarks and that to the best of its knowledge no legal action has been taken against it for any infringement or violation of any 3rd party intellectual property rights.
* 8.2. **No-Warranty:** The Software is provided without any warranty; Licensor hereby disclaims any warranty that The Software shall be error free, without defects or code which may cause damage to Licensee's computers or to Licensee, and that Software shall be functional. Licensee shall be solely liable to any damage, defect or loss incurred as a result of operating software and undertake the risks contained in running The Software on License's Server[s] and Website[s].
* 8.3. **Prior Inspection:** Licensee hereby states that he inspected The Software thoroughly and found it satisfactory and adequate to his needs, that it does not interfere with his regular operation and that it does meet the standards and scope of his computer systems and architecture. Licensee found that The Software interacts with his development, website and server environment and that it does not infringe any of End User License Agreement of any software Licensee may use in performing his services. Licensee hereby waives any claims regarding The Software's incompatibility, performance, results and features, and warrants that he inspected the The Software.
9. **No Refunds:** Licensee warrants that he inspected The Software according to clause 7(c) and that it is adequate to his needs. Accordingly, as The Software is intangible goods, Licensee shall not be, ever, entitled to any refund, rebate, compensation or restitution for any reason whatsoever, even if The Software contains material flaws.
10. **Indemnification:** Licensee hereby warrants to hold Licensor harmless and indemnify Licensor for any lawsuit brought against it in regards to Licensee's use of The Software in means that violate, breach or otherwise circumvent this license, Licensor's intellectual property rights or Licensor's title in The Software. Licensor shall promptly notify Licensee in case of such legal action and request Licensee's consent prior to any settlement in relation to such lawsuit or claim.
11. **Governing Law, Jurisdiction:** Licensee hereby agrees not to initiate class-action lawsuits against Licensor in relation to this license and to compensate Licensor for any legal fees, cost or attorney fees should any claim brought by Licensee against Licensor be denied, in part or in full.

2
README.md

@ -5,8 +5,6 @@ A TwitchTV viewer reward system
Written in Node and JavaScript
*By having access to this repository you and any authorized 3rd Parties agree to the [software license](https://github.com/SupremoRTD/LoyaltyBot/blob/master/License.md#software-license-for-loyaltybot)*
Overview
--------

21
lib/dashboard/404.html

@ -1,21 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>ArchonBot 404</title>
<link href="http://www.twitch.tv/favicon.ico" rel="shortcut icon" type="image/x-icon" />
<style>
@font-face{font-family: orangejuice;src:url('/webfonts/scoolar_tfb.ttf'),url('/webfonts/scoolar_tfb.eot');}
body{background:url('/images/background.jpg');}
*{margin:0px; padding:0px;}
#container{padding:20px}
#wrapper{width:800px;margin:0 auto;}
#robot{background:url('/images/archonbot.png');width:126px;height:175px;float:right;margin-right:30px}
#status{width:500px;margin:0 auto;}
.error{font-family:orangejuice;font-size:62pt;color:#FFF;}
.fourohfour{font-size:135pt;color:#8266B6;}
</style>
</head>
<body>
<div id="container"><div id="wrapper"><div id="status" class="error"><span class="fourohfour">404</span><div id="robot"></div></div><div class="error">Whatever it is you are looking for, ArchonBot has not created.</div></div></div>
</body>
</html>

191
lib/dashboard/css/dashboard.css

@ -1,191 +0,0 @@
@font-face{font-family:"Korolev-Bold";
src:url("/webfonts/22AE77_0_0.eot");
src:url("/webfonts/22AE77_0_0.eot?#iefix") format("embedded-opentype"), url("/webfonts/22AE77_0_0.woff") format("woff"), url("/webfonts/22AE77_0_0.ttf") format("truetype");}
*{margin:0;
padding:0;}
html{overflow-y:scroll;}
body{color:#000;
font:12px "Helvetica Neue", Helvetica, Arial, sans-serif;
line-height:1.5;
text-rendering:optimizeLegibility;
background:#262626;
background-image:url('/images/background.jpg');}
a{text-decoration:none;}
a:hover{text-decoration:underline;}
img{border:0;
vertical-align:top;}
li{list-style-position:inside;}
h4{font-size:16px;
line-height:1.25;
font-weight:bold;}
h5{font-size:14px;
line-height:1.286;
font-weight:bold;}
button:focus{outline:none;}
input[type="submit"]:focus, input[type="button"]:focus, input[type="cancel"]:focus, input[type="reset"]:focus{outline:none;}
.bar{height:35px;
line-height:35px;
padding:0 10px 0 40px;
color:#666;
font-size:13px;
text-shadow:1px 1px 0 rgba(255, 255, 255, .8);
box-shadow:inset 0 -1px 0 rgba(0, 0, 0, .1);
background:url('/images/icons.png') no-repeat -4px -408px #e9e9e9;}
.bar h4{float:left;
width:130px;
margin:0;
padding:0;
font-size:13px;
line-height:35px;
text-overflow:ellipsis;
overflow:hidden;}
.bar span{float:right;
font-style:italic;
opacity:.7;}
.clear{clear:both;}
.nick{text-transform:capitalize;}
.main, .footer{width:980px;}
.main{margin:40px auto 20px;
padding:20px 0;
border:1px solid #fff;
border-bottom:1px solid #fff;
background:transparent url(/images/transparent_pxl_white-90.png);
background:rgba(255, 255, 255, 0.9);
box-shadow:0 0 5px rgba(0, 0, 0, 0.35);
-moz-box-shadow:0 0 5px rgba(0, 0, 0, 0.35);
-webkit-box-shadow:0 0 5px rgba(0, 0, 0, 0.35);}
.wrapper{width:940px;
margin:0 auto;
padding:0 20px;
position:relative;}
.primary_button, .normal_button{border-radius:3px;
-moz-border-radius:3px;
-webkit-border-radius:3px;
display:inline-block;
position:relative;
vertical-align:baseline;
font-size:inherit;
font-weight:500;
border:1px solid #000;
background:none;
cursor:pointer;
font-family:inherit;
font-weight:bold;
width:1;
overflow:visible;}
.primary_button span, .normal_button span{display:inline-block;
height:18px;
padding:5px 9px;
white-space:nowrap;
line-height:18px;}
.primary_button{background:-webkit-gradient(linear, left top, left bottom, from(#8266b6), to(#533787));
background:-moz-linear-gradient(top, #8266b6, #533787);
background:-o-linear-gradient(top, #8266b6, #533787);
background:linear-gradient(top, #8266b6, #533787);
background-color:#6a4e9e;
border-top:1px solid #5b3f8f;
border-left:1px solid #412771;
border-right:1px solid #412771;
border-bottom:1px solid #2a1453;
box-shadow:inset 0 1px 0 rgba(255, 255, 255, 0.1), 0 1px 0 rgba(0, 0, 0, 0.15);
-moz-box-shadow:inset 0 1px 0 rgba(255, 255, 255, 0.1), 0 1px 0 rgba(0, 0, 0, 0.15);
-webkit-box-shadow:inset 0 1px 0 rgba(255, 255, 255, 0.1), 0 1px 0 rgba(0, 0, 0, 0.15);
text-shadow:0 1px 0 rgba(0, 0, 0, 0.75);
-moz-text-shadow:0 1px 0 rgba(0, 0, 0, 0.75);
-webkit-text-shadow:0 1px 0 rgba(0, 0, 0, 0.75);
color:#fff;}
.normal_button{background:-webkit-gradient(linear, left top, left bottom, from(#f5f5f5), to(#ddd));
background:-moz-linear-gradient(top, #f5f5f5, #ddd);
background:-o-linear-gradient(top, #f5f5f5, #ddd);
background:linear-gradient(top, #f5f5f5, #ddd);
background-color:#e9e9e9;
border-top:1px solid rgba(0, 0, 0, 0.2);
border-left:1px solid rgba(0, 0, 0, 0.3);
border-right:1px solid rgba(0, 0, 0, 0.3);
border-bottom:1px solid rgba(0, 0, 0, 0.35);
box-shadow:inset 0 1px 0 #fff, 0 1px 0 rgba(0, 0, 0, 0.07);
-moz-box-shadow:inset 0 1px 0 #fff, 0 1px 0 rgba(0, 0, 0, 0.07);
-webkit-box-shadow:inset 0 1px 0 #fff, 0 1px 0 rgba(0, 0, 0, 0.07);
text-shadow:0 1px 0 rgba(255, 255, 255, 0.75);
-moz-text-shadow:0 1px 0 rgba(255, 255, 255, 0.75);
-webkit-text-shadow:0 1px 0 rgba(255, 255, 255, 0.75);}
a.button:hover, a.primary_button:hover, a.normal_button:hover{text-decoration:none;}
.form_submit{float:right;
margin-top:0;
margin-right:5px}
.auction_status{display:block;
float:right;
margin:-8px -8px 5px 0;
padding:0;
width:55px;
height:50px;
font-size:12px;
line-height:40px;
color:#E3DAF2;
background:url('/images/vector-web-icons.png') no-repeat 0 0 transparent;
border:0;
opacity:.2;
text-indent:100%;
overflow:hidden;
background-position:-160px -268px;}
.section_header{margin-bottom:10px;
color:#666;}
.bottom_box{border:1px solid #ccc;
border-top:none;
border-radius:0;
-moz-border-radius:0;
-webkit-border-radius:0;
background:#f1f1f1;}
#mantle_skin{z-index:-1000;}
#site_footer{margin:0 auto;
padding-bottom:60px;}
#site_footer a{color:#fff;
font-weight:500;
text-shadow:0 1px 0 #000;}
#footer_archonbot{float:left;
vertical-align:top;}
#footer_links{float:left;}
#footer_links li{display:inline;
display:inline-block;
margin:0 6px;}
#copyright_and_languages{float:right;
color:#666;}
#copyright_and_languages #copyright{margin-left:10px;}
#chat_lines{height:346px;
padding:10px 5px 10px 10px}
#twitch_chat{margin-bottom:10px;
border:1px solid #ccc;
border-radius:4px;}
#chat_line_list li{list-style:none;}
#chat_line_list li p{margin-bottom:5px;}
#chat_line_list li .nick{font-weight:bold;
text-transform:capitalize;}
#auction_submit_buttons{margin:0 -5px 0 0;
height:25px}
#auction_lines{height:173px;
margin-bottom:10px;
border:1px solid #ccc;
border-radius:4px;}
#irc_submit{float:right;
margin-top:-37px;}
#auction_box{width:325px;
margin-bottom:10px;}
#auction_box, #chat{position:relative;
padding:15px;
border:1px solid #CCC;
border-radius:0;
-moz-border-radius:0;
-webkit-border-radius:0;
border-top-right-radius:5px;
border-top-left-radius:5px;
-moz-border-radius-topright:5px;
-moz-border-radius-topleft:5px;
-webkit-border-top-left-radius:5px;
-webkit-border-top-right-radius:5px;
border-bottom-right-radius:5px;
border-bottom-left-radius:5px;
-moz-border-radius-bottomright:5px;
-moz-border-radius-bottomleft:5px;
-webkit-border-bottom-left-radius:5px;
-webkit-border-bottom-right-radius:5px;
background:#F1F1F1;}

208
lib/dashboard/css/jquery.mCustomScrollbar.css

@ -1,208 +0,0 @@
/* basic scrollbar styling */
/* vertical scrollbar */
.mCSB_container{
width:auto;
margin-right:30px;
overflow:hidden;
}
.mCSB_container.mCS_no_scrollbar{
margin-right:0;
}
.mCS_disabled .mCSB_container.mCS_no_scrollbar,
.mCS_destroyed .mCSB_container.mCS_no_scrollbar{
margin-right:30px;
}
.mCustomScrollBox .mCSB_scrollTools{
width:16px;
height:100%;
top:0;
right:-5px;
}
.mCSB_scrollTools .mCSB_draggerContainer{
height:100%;
-webkit-box-sizing:border-box;
-moz-box-sizing:border-box;
box-sizing:border-box;
}
.mCSB_scrollTools .mCSB_buttonUp+.mCSB_draggerContainer{
padding-bottom:40px;
}
.mCSB_scrollTools .mCSB_draggerRail{
width:5px;
height:100%;
margin:0 auto;
-webkit-border-radius:10px;
-moz-border-radius:10px;
border-radius:10px;
}
.mCSB_scrollTools .mCSB_dragger{
cursor:pointer;
width:100%;
height:30px;
}
.mCSB_scrollTools .mCSB_dragger .mCSB_dragger_bar{
width:5px;
height:100%;
margin:0 auto;
-webkit-border-radius:10px;
-moz-border-radius:10px;
border-radius:10px;
text-align:center;
}
.mCSB_scrollTools .mCSB_buttonUp,
.mCSB_scrollTools .mCSB_buttonDown{
height:20px;
overflow:hidden;
margin:0 auto;
cursor:pointer;
}
.mCSB_scrollTools .mCSB_buttonDown{
bottom:0;
margin-top:-40px;
}
/* horizontal scrollbar */
.mCSB_horizontal .mCSB_container{
height:auto;
margin-right:0;
margin-bottom:30px;
overflow:hidden;
}
.mCSB_horizontal .mCSB_container.mCS_no_scrollbar{
margin-bottom:0;
}
.mCS_disabled .mCSB_horizontal .mCSB_container.mCS_no_scrollbar,
.mCS_destroyed .mCSB_horizontal .mCSB_container.mCS_no_scrollbar{
margin-right:0;
margin-bottom:30px;
}
.mCSB_horizontal.mCustomScrollBox .mCSB_scrollTools{
width:100%;
height:16px;
top:auto;
right:auto;
bottom:0;
left:0;
overflow:hidden;
}
.mCSB_horizontal .mCSB_scrollTools .mCSB_draggerContainer{
height:100%;
width:auto;
-webkit-box-sizing:border-box;
-moz-box-sizing:border-box;
box-sizing:border-box;
overflow:hidden;
}
.mCSB_horizontal .mCSB_scrollTools .mCSB_buttonLeft+.mCSB_draggerContainer{
padding-bottom:0;
padding-right:20px;
}
.mCSB_horizontal .mCSB_scrollTools .mCSB_draggerRail{
width:100%;
height:2px;
margin:7px 0;
-webkit-border-radius:10px;
-moz-border-radius:10px;
border-radius:10px;
}
.mCSB_horizontal .mCSB_scrollTools .mCSB_dragger{
width:30px;
height:100%;
}
.mCSB_horizontal .mCSB_scrollTools .mCSB_dragger .mCSB_dragger_bar{
width:100%;
height:4px;
margin:6px auto;
-webkit-border-radius:10px;
-moz-border-radius:10px;
border-radius:10px;
}
.mCSB_horizontal .mCSB_scrollTools .mCSB_buttonLeft,
.mCSB_horizontal .mCSB_scrollTools .mCSB_buttonRight{
width:20px;
height:100%;
overflow:hidden;
margin:0 auto;
cursor:pointer;
float:left;
}
.mCSB_horizontal .mCSB_scrollTools .mCSB_buttonRight{
right:0;
bottom:auto;
margin-left:-40px;
margin-top:-16px;
float:right;
}
/* default scrollbar colors and backgrounds */
.mCustomScrollBox .mCSB_scrollTools{
opacity:0.75;
}
.mCustomScrollBox:hover .mCSB_scrollTools{
opacity:1;
}
.mCSB_scrollTools .mCSB_draggerRail{
background:#000; /* rgba fallback */
background:rgba(0,0,0,0.4);
filter:"alpha(opacity=40)"; -ms-filter:"alpha(opacity=40)"; /* old ie */
}
.mCSB_scrollTools .mCSB_dragger .mCSB_dragger_bar{
background:#fff; /* rgba fallback */
background:rgba(42,255,0,0.75);
filter:"alpha(opacity=75)"; -ms-filter:"alpha(opacity=75)"; /* old ie */
}
.mCSB_scrollTools .mCSB_dragger:hover .mCSB_dragger_bar{
background:rgba(42,255,0,0.85);
filter:"alpha(opacity=85)"; -ms-filter:"alpha(opacity=85)"; /* old ie */
}
.mCSB_scrollTools .mCSB_dragger:active .mCSB_dragger_bar,
.mCSB_scrollTools .mCSB_dragger.mCSB_dragger_onDrag .mCSB_dragger_bar{
background:rgba(42,255,0,0.9);
filter:"alpha(opacity=90)"; -ms-filter:"alpha(opacity=90)"; /* old ie */
}
.mCSB_scrollTools .mCSB_buttonUp,
.mCSB_scrollTools .mCSB_buttonDown,
.mCSB_scrollTools .mCSB_buttonLeft,
.mCSB_scrollTools .mCSB_buttonRight{
background-image:url(mCSB_buttons.png);
background-repeat:no-repeat;
opacity:0.4;
filter:"alpha(opacity=40)"; -ms-filter:"alpha(opacity=40)"; /* old ie */
}
.mCSB_scrollTools .mCSB_buttonUp{
background-position:0 0;
/*
sprites locations are 0 0/-16px 0/-32px 0/-48px 0 (light) and -80px 0/-96px 0/-112px 0/-128px 0 (dark)
*/
}
.mCSB_scrollTools .mCSB_buttonDown{
background-position:0 -20px;
/*
sprites locations are 0 -20px/-16px -20px/-32px -20px/-48px -20px (light) and -80px -20px/-96px -20px/-112px -20px/-128px -20px (dark)
*/
}
.mCSB_scrollTools .mCSB_buttonLeft{
background-position:0 -40px;
/*
sprites locations are 0 -40px/-20px -40px/-40px -40px/-60px -40px (light) and -80px -40px/-100px -40px/-120px -40px/-140px -40px (dark)
*/
}
.mCSB_scrollTools .mCSB_buttonRight{
background-position:0 -56px;
/*
sprites locations are 0 -56px/-20px -56px/-40px -56px/-60px -56px (light) and -80px -56px/-100px -56px/-120px -56px/-140px -56px (dark)
*/
}
.mCSB_scrollTools .mCSB_buttonUp:hover,
.mCSB_scrollTools .mCSB_buttonDown:hover,
.mCSB_scrollTools .mCSB_buttonLeft:hover,
.mCSB_scrollTools .mCSB_buttonRight:hover{
opacity:0.75;
filter:"alpha(opacity=75)"; -ms-filter:"alpha(opacity=75)"; /* old ie */
}
.mCSB_scrollTools .mCSB_buttonUp:active,
.mCSB_scrollTools .mCSB_buttonDown:active,
.mCSB_scrollTools .mCSB_buttonLeft:active,
.mCSB_scrollTools .mCSB_buttonRight:active{
opacity:0.9;
filter:"alpha(opacity=90)"; -ms-filter:"alpha(opacity=90)"; /* old ie */
}

85
lib/dashboard/dashboard.html

@ -1,85 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>#{{channelname}} Dashboard - {{botname}}</title>
<link href="http://www.twitch.tv/favicon.ico" rel="shortcut icon" type="image/x-icon"/>
<link href="/css/dashboard.css" media="screen" rel="stylesheet"/>
<link href="/css/jquery.mCustomScrollbar.css" media="screen" rel="stylesheet"/>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
<script src="//ajax.googleapis.com/ajax/libs/jqueryui/1.9.2/jquery-ui.min.js"></script>
<script src="/js/jquery.mousewheel.min.js"></script>
<script src="/js/jquery.mCustomScrollbar.js"></script>
<script src="/js/actions.js"></script>
</head>
<body>
<div id="mantle_skin">
<div class="main" id="container">
<div class="wrapper" id="dash_main">
<div id="auction_box">
<div class="auction_status">Close</div>
<h4 class="section_header">Arcoins Auction</h4>
<h5 class="section_header" id="auction_highest_bid">Status: <span style="color:blueviolet">Closed</span></h5>
<div id="auction_lines" class="auction-scroll clear">
<div class="bar">
<h4>Messages</h4>
<span>updating in real time</span>
</div>
<ul id="auction_line_list"></ul>
<div id="auction_line_end"></div>
</div>
<div id="auction_submit_buttons">
<form id="auction_open" method="post">
<div style="margin:0;padding:0;display:inline">
<input name="authenticity_token" type="hidden" value=""/>
<input name="user" type="hidden" value="{{user}}"/>
</div>
<div class="form_submit">
<button class="primary_button" tabindex="5" type="submit"><span>Open Auction</span></button>
</div>
</form>
<form id="auction_close" method="post">
<div style="margin:0;padding:0;display:inline">
<input name="authenticity_token" type="hidden" value=""/>
<input name="user" type="hidden" value="{{user}}"/>
</div>
<div class="form_submit">
<button class="primary_button" tabindex="4" type="submit"><span>Close Auction</span></button>
</div>
</form>
</div>
</div>
<div class="clear" id="chat">
<h4 class="section_header">Twitch IRC Raw Chat</h4>
<form id="irc_reconnect" class="simple_form clearfix" method="post">
<div style="margin:0;padding:0;display:inline">
<input name="authenticity_token" type="hidden" value=""/>
</div>
<div id="irc_submit">
<button class="normal_button" tabindex="5" type="submit"><span>Reconnect</span></button>
</div>
</form>
<div id="twitch_chat" class="chat_box">
<div class="bar">
<h4>Messages</h4>
<span>updating in real time</span>
</div>
<div id="chat_lines" class="chat-scroll">
<ul id="chat_line_list"></ul>
<div id="chat_line_end"></div>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="footer clearfix" id="site_footer">
<p id="copyright_and_languages">
<span id="copyright">© ArchonBot 2013, © Justin.tv Inc. 2013</span>
</p>
<img alt="ArchonBot" id="footer_archonbot" src="/images/archonbot.png" width="126" height="175"/>
<ul id="footer_links">
<li><a href="https://github.com/SupremoRTD/ArchonBot">ArchonBot on GitHub</a></li>
</ul>
</div>
</body>
</html>

175
lib/dashboard/dashboard.js

@ -1,175 +0,0 @@
var file = require('fs'),
http = require('http'),
querystring = require('querystring'),
mustache = require('mustache');
function Server(irc, options) {
var __self = this;
__self.options = options || {};
__self.irc = irc;
//config
__self.root = __self.options.root || '';
__self.channel = __self.options.channel.toLowerCase() || '';
__self.bot = __self.options.bot_name || '';
__self.port = __self.options.dashboard_id || '';
}
Server.prototype.start = function () {
var __self = this;
http.createServer(function (request, response) {
var handle, patterns, rest_uri, match, mimes;
mimes = [
{css: 'text/css', encoding: 'utf8'},
{js: 'application/javascript', encoding: 'utf8'},
{html: 'text/html', encoding: 'utf8'},
{jpg: 'image/jpeg', encoding: 'binary'},
{png: 'image/png', encoding: 'binary'},
{gif: 'image/gif', encoding: 'binary'},
{eot: 'application/vnd.ms-fontobject', encoding: 'binary'},
{otf: 'application/octet-stream', encoding: 'binary'},
{ttf: 'application/octet-stream', encoding: 'binary'},
{woff: 'application/x-font-woff', encoding: 'binary'}
];
// remove start and end slashes
rest_uri = request.url.replace(/^\/|\/$/i, '');
// reg patterns
patterns = {
realtimechat: /get\/chat$/i,
dashboard: /v1\/dashboard$/i,
actions: /actions$/i,
all: /(.*\/)(.*)\.(\w+)$|(.*)\.(\w+)$/i
};
// match with patterns
for (var key in patterns) {
if (patterns[key].test(rest_uri)) {
match = rest_uri.match(patterns[key]);
handle = key;
break;
}
}
// organize requests
if (handle == 'realtimechat') {
response.writeHead(200, {'Content-Type': 'application/json'});
file.exists(__self.log, function (exists) {
if (exists) {
file.readFile(__self.log, 'utf8', function (err, data) {
if (data !== null) {
var json = [];
data = data.split('\r\n');
for (var i = 0; i < data.length - 1; i++) {
json[i] = {id: i, text: data[i]};
}
response.end(JSON.stringify(json));
}
// TODO: fix up the json request so it takes less memory
/*if (data !== null) {
var json = [], max_length;
data = data.split('\r\n');
max_length = data.length > 200 ? 200 : data.length;
for (var i = 0; i < max_length; i++) {
var check_length = data.length > 200 ? (data.length - 200) + i : i;
json[i] = {id: check_length, text: data[check_length]};
}
response.end(JSON.stringify(json));
}*/
});
} else {
response.end('{"Error":"Chat does not exist"}');
}
});
}
if (handle == 'dashboard') {
file.readFile(__self.root + '/dashboard.html', 'utf8', function (err, data) {
var template = {botname: __self.bot, channelname: __self.channel, user: __self.channel.charAt(0).toUpperCase() + __self.channel.slice(0).toLowerCase()};
response.writeHead(200, {'Content-Type': 'text/html'});
response.end(mustache.render(data, template));
});
}
if (handle == 'actions') {
if (request.method == 'POST') {
var post_header = '';
request.on('data', function (chunk) {
post_header += chunk.toString();
});
request.on('end', function () {
var decoded_header = querystring.parse(post_header);
response.writeHead(200, {'Content-Type': 'text/html'});
switch(decoded_header._method) {
case 'reconnect':
__self.irc.reconnect();
response.end();
break;
case 'auction_open':
__self.irc.msg('!arcoins auction open');
response.end();
break;
case 'auction_close':
__self.irc.msg('!arcoins auction close');
response.end();
break;
default:
response.end();
}
});
}
}
if (handle == 'all') {
file.exists(__self.root + '/' + match[0], function (exists) {
if (exists) {
var mime, encoding;
for (var i = 0; i < mimes.length; i++) {
for (var key in mimes[i]) {
if (match[3] == key || match[5] == key) {
mime = mimes[i][key];
encoding = mimes[i].encoding;
break;
}
}
}
file.readFile(__self.root + '/' + match[0], encoding, function (err, data) {
response.writeHead(200, {'Content-Type': mime});
if (encoding == 'binary') {
response.end(data, 'binary');
} else {
response.end(data);
}
});
} else {
fourohfour();
}
});
}
if (handle === undefined) {
fourohfour();
}
function fourohfour() {
file.readFile(__self.root + '/404.html', 'utf8', function (err, data) {
response.writeHead(404, {'Content-Type': 'text/html'});
response.end(data);
});
}
}).listen(__self.port);
console.log('> Dashboard for ' + __self.bot + ' running on http://localhost:' + __self.port + '/v1/dashboard');
};
module.exports = function (irc, options) {
return new Server(irc, options);
};

BIN
lib/dashboard/images/archonbot.png

Before

Width: 126  |  Height: 175  |  Size: 14 KiB

BIN
lib/dashboard/images/background.jpg

Before

Width: 1000  |  Height: 1000  |  Size: 80 KiB

BIN
lib/dashboard/images/icons.png

Before

Width: 100  |  Height: 700  |  Size: 18 KiB

0
lib/dashboard/images/transparent_pxl_white-90.png

BIN
lib/dashboard/images/vector-web-icons.png

Before

Width: 600  |  Height: 493  |  Size: 195 KiB

167
lib/dashboard/js/actions.js

@ -1,167 +0,0 @@
//-------- Realtime Chat --------
(function ($) {
var previous_chat = [], origin = window.location.origin;
function get_chat() {
$.ajax({
url: origin + '/get/chat',
success: function (data) {
for (var key in data) {
if (data.hasOwnProperty(key)) {
if (data[key].id !== undefined || data[key].text !== undefined) {
if (previous_chat.indexOf(data[key].id) < 0) {
// add line id to array
previous_chat.push(data[key].id);
// separate words
var data_split = data[key].text.split(' ');
//-------- Raw IRC Module --------
update_raw_irc_module(data_split);
update_scrollbar();
//-------- Auction Module --------
update_auction_module(data_split);
}
}
}
}
get_chat();
},
error: function (x, t) {
if (t === 'timeout') {
$('#chat_line_list').append('<li class="line jtv"><p><span class="chat_line">Server: Request timed out, trying to reconnect (server may be offline)</span></p></li>');
update_scrollbar();
}
get_chat();
}, dataType: "json", timeout: 30000
});
}
// start "realtime" chat
get_chat();
function update_scrollbar () {
// update scrollbar
$('.chat-scroll').mCustomScrollbar("update");
$('.chat-scroll').mCustomScrollbar("scrollTo","#chat_line_end");
}
function update_raw_irc_module (data) {
// raw irc status colors
switch(data[0]) {
case 'SENT':
data.splice(0, 1, '<span class="nick" style="color:dodgerblue">' + data[0] + '&nbsp;</span>');
break;
case 'RECV':
data.splice(0, 1, '<span class="nick" style="color:red">' + data[0] + '&nbsp;</span>');
break;
}
// raw irc message / server response colors
if (data[3] === 'PRIVMSG') {
var user = data[2].split('!');
if (user.length > 1) {
data.splice(2, 1, '<span style="color:blueviolet;font-style:italic;font-weight:bold">' + user[0].slice(1).charAt(0).toUpperCase() + user[0].slice(2).toLowerCase() + '</span>');
} else {
data.splice(2, 1, '<span style="color:blueviolet;font-style:italic;font-weight:bold">' + user + '</span>');
}
data.splice(3, 1, '<span style="color:blueviolet;font-style:italic;font-weight:bold">' + data[3] + '</span>');
data.splice(4, 1, '<span style="color:#666;font-style:italic">' + data[4] + '</span>');
data.splice(5, 1, data[5].slice(1));
} else {
for (var i = 2; i < data.length; i++) {
if (i === 2) {
data.splice(i, 1, '<span style="color:#666;font-style:italic">' + data[i]);
} else if (i === data.length - 1) {
data.splice(i, 1, data[i] + '</span>');
}
}
}
// add chat line to view
if (data[3] !== '352') {
$('#chat_line_list').append('<li class="line jtv"><p><span class="chat_line">' + data.join(' ') + '</span></p></li>');
}
// remove first chat line if over limit
if (previous_chat.length > 200 && $('#chat_line_list li').length > 200) {
$('#chat_line_list li').first().remove();
previous_chat = previous_chat.slice(1);
}
}
function update_auction_module (data) {
var data_text = '';
for (var i = 6; i < data.length; i++) {
data_text += i !== data.length - 1 ? data[i] + ' ' : data[i];
}
// set auction info
if (data_text === 'Auction opened, accepting bids') {
$('.auction_status').css({'opacity':'1', 'background-position': '-230px -268px'}).text('Opened');
$('#auction_highest_bid').html('').text('Status: ').append('<span style="color: blueviolet">Checking Bids...</span>');
}
if (data[6] + ' ' + data[7] === 'Highest bid,') {
$('#auction_highest_bid').html('').text('Highest Bid: ').append('<span style="color: blueviolet">' + data[8] + ' @ ' + data[10] + '</span>');
}
if (data[6] + ' ' + data[7] + ' ' + data[8] == 'Auction closed, Winner:') {
$('.auction_status').css({'opacity': '.2', 'background-position': '-160px -268px'}).text('Closed');
$('#auction_highest_bid').html('').text('Winner: ').append('<span style="color: blueviolet">' + data[9] + ' @ ' + data[11] + '</span>');
}
if (data_text === 'Auction closed, no bidders to pick a winner') {
$('.auction_status').css({'opacity': '.2', 'background-position': '-160px -268px'}).text('Closed');
$('#auction_highest_bid').html('').text('Status: ').append('<span style="color: blueviolet">Closed</span>');
}
}
})(jQuery);
//-------- Scrollbars --------
(function ($) {
$(document).ready(function () {
$('.auction-scroll').mCustomScrollbar({
scrollInertia:0,
advanced:{
updateOnContentResize: true
}
});
$('.chat-scroll').mCustomScrollbar({
scrollInertia:0,
advanced:{
updateOnContentResize: true
}
});
});
})(jQuery);
//-------- Form Actions --------
(function ($) {
$(document).ready(function () {
// reconnect to irc
$('#irc_reconnect').submit(function (e) {
e.preventDefault();
$.ajax({
type: 'POST',
url: window.location.origin + '/actions',
data: {_method: 'reconnect', auth_token: $(this).find('input[name="authenticity_token"]').val()}
});
});
// open / close auction
$('#auction_open').submit(function (e) {
e.preventDefault();
$.ajax({
type: 'POST',
url: window.location.origin + '/actions',
data: {_method: 'auction_open', auth_token: $(this).find('input[name="authenticity_token"]').val(), user: $(this).find('input[name="user"]').val()}
});
});
$('#auction_close').submit(function (e) {
e.preventDefault();
$.ajax({
type: 'POST',
url: window.location.origin + '/actions',
data: {_method: 'auction_close', auth_token: $(this).find('input[name="authenticity_token"]').val(), user: $(this).find('input[name="user"]').val()}
});
});
});
})(jQuery);

874
lib/dashboard/js/jquery.mCustomScrollbar.js

@ -1,874 +0,0 @@
/*
== malihu jquery custom scrollbars plugin ==
version: 2.3.2
author: malihu (http://manos.malihu.gr)
plugin home: http://manos.malihu.gr/jquery-custom-content-scroller
*/
(function($){
var methods={
init:function(options){
var defaults={
set_width:false, /*optional element width: boolean, pixels, percentage*/
set_height:false, /*optional element height: boolean, pixels, percentage*/
horizontalScroll:false, /*scroll horizontally: boolean*/
scrollInertia:550, /*scrolling inertia: integer (milliseconds)*/
scrollEasing:"easeOutCirc", /*scrolling easing: string*/
mouseWheel:"pixels", /*mousewheel support and velocity: boolean, "auto", integer, "pixels"*/
mouseWheelPixels:60, /*mousewheel pixels amount: integer*/
autoDraggerLength:true, /*auto-adjust scrollbar dragger length: boolean*/
scrollButtons:{ /*scroll buttons*/
enable:false, /*scroll buttons support: boolean*/
scrollType:"continuous", /*scroll buttons scrolling type: "continuous", "pixels"*/
scrollSpeed:20, /*scroll buttons continuous scrolling speed: integer*/
scrollAmount:40 /*scroll buttons pixels scroll amount: integer (pixels)*/
},
advanced:{
updateOnBrowserResize:true, /*update scrollbars on browser resize (for layouts based on percentages): boolean*/
updateOnContentResize:false, /*auto-update scrollbars on content resize (for dynamic content): boolean*/
autoExpandHorizontalScroll:false, /*auto-expand width for horizontal scrolling: boolean*/
autoScrollOnFocus:true /*auto-scroll on focused elements: boolean*/
},
callbacks:{
onScrollStart:function(){}, /*user custom callback function on scroll start event*/
onScroll:function(){}, /*user custom callback function on scroll event*/
onTotalScroll:function(){}, /*user custom callback function on scroll end reached event*/
onTotalScrollBack:function(){}, /*user custom callback function on scroll begin reached event*/
onTotalScrollOffset:0, /*scroll end reached offset: integer (pixels)*/
whileScrolling:false, /*user custom callback function on scrolling event*/
whileScrollingInterval:30 /*interval for calling whileScrolling callback: integer (milliseconds)*/
}
},
options=$.extend(true,defaults,options);
/*check for touch device*/
$(document).data("mCS-is-touch-device",false);
if(is_touch_device()){
$(document).data("mCS-is-touch-device",true);
}
function is_touch_device(){
return !!("ontouchstart" in window) ? 1 : 0;
}
return this.each(function(){
var $this=$(this);
/*set element width/height, create markup for custom scrollbars, add classes*/
if(options.set_width){
$this.css("width",options.set_width);
}
if(options.set_height){
$this.css("height",options.set_height);
}
if(!$(document).data("mCustomScrollbar-index")){
$(document).data("mCustomScrollbar-index","1");
}else{
var mCustomScrollbarIndex=parseInt($(document).data("mCustomScrollbar-index"));
$(document).data("mCustomScrollbar-index",mCustomScrollbarIndex+1);
}
$this.wrapInner("<div class='mCustomScrollBox' id='mCSB_"+$(document).data("mCustomScrollbar-index")+"' style='position:relative; height:100%; overflow:hidden; max-width:100%;' />").addClass("mCustomScrollbar _mCS_"+$(document).data("mCustomScrollbar-index"));
var mCustomScrollBox=$this.children(".mCustomScrollBox");
if(options.horizontalScroll){
mCustomScrollBox.addClass("mCSB_horizontal").wrapInner("<div class='mCSB_h_wrapper' style='position:relative; left:0; width:999999px;' />");
var mCSB_h_wrapper=mCustomScrollBox.children(".mCSB_h_wrapper");
mCSB_h_wrapper.wrapInner("<div class='mCSB_container' style='position:absolute; left:0;' />").children(".mCSB_container").css({"width":mCSB_h_wrapper.children().outerWidth(),"position":"relative"}).unwrap();
}else{
mCustomScrollBox.wrapInner("<div class='mCSB_container' style='position:relative; top:0;' />");
}
var mCSB_container=mCustomScrollBox.children(".mCSB_container");
if($(document).data("mCS-is-touch-device")){
mCSB_container.addClass("mCS_touch");
}
mCSB_container.after("<div class='mCSB_scrollTools' style='position:absolute;'><div class='mCSB_draggerContainer' style='position:relative;'><div class='mCSB_dragger' style='position:absolute;'><div class='mCSB_dragger_bar' style='position:relative;'></div></div><div class='mCSB_draggerRail'></div></div></div>");
var mCSB_scrollTools=mCustomScrollBox.children(".mCSB_scrollTools"),
mCSB_draggerContainer=mCSB_scrollTools.children(".mCSB_draggerContainer"),
mCSB_dragger=mCSB_draggerContainer.children(".mCSB_dragger");
if(options.horizontalScroll){
mCSB_dragger.data("minDraggerWidth",mCSB_dragger.width());
}else{
mCSB_dragger.data("minDraggerHeight",mCSB_dragger.height());
}
if(options.scrollButtons.enable){
if(options.horizontalScroll){
mCSB_scrollTools.prepend("<a class='mCSB_buttonLeft' style='display:block; position:relative;'></a>").append("<a class='mCSB_buttonRight' style='display:block; position:relative;'></a>");
}else{
mCSB_scrollTools.prepend("<a class='mCSB_buttonUp' style='display:block; position:relative;'></a>").append("<a class='mCSB_buttonDown' style='display:block; position:relative;'></a>");
}
}
/*mCustomScrollBox scrollTop and scrollLeft is always 0 to prevent browser focus scrolling*/
mCustomScrollBox.bind("scroll",function(){
if(!$this.is(".mCS_disabled")){ /*native focus scrolling for disabled scrollbars*/
mCustomScrollBox.scrollTop(0).scrollLeft(0);
}
});
/*store options, global vars/states, intervals and update element*/
$this.data({
/*init state*/
"mCS_Init":true,
/*option parameters*/
"horizontalScroll":options.horizontalScroll,
"scrollInertia":options.scrollInertia,
"scrollEasing":options.scrollEasing,
"mouseWheel":options.mouseWheel,
"mouseWheelPixels":options.mouseWheelPixels,
"autoDraggerLength":options.autoDraggerLength,
"scrollButtons_enable":options.scrollButtons.enable,
"scrollButtons_scrollType":options.scrollButtons.scrollType,
"scrollButtons_scrollSpeed":options.scrollButtons.scrollSpeed,
"scrollButtons_scrollAmount":options.scrollButtons.scrollAmount,
"autoExpandHorizontalScroll":options.advanced.autoExpandHorizontalScroll,
"autoScrollOnFocus":options.advanced.autoScrollOnFocus,
"onScrollStart_Callback":options.callbacks.onScrollStart,
"onScroll_Callback":options.callbacks.onScroll,
"onTotalScroll_Callback":options.callbacks.onTotalScroll,
"onTotalScrollBack_Callback":options.callbacks.onTotalScrollBack,
"onTotalScroll_Offset":options.callbacks.onTotalScrollOffset,
"whileScrolling_Callback":options.callbacks.whileScrolling,
"whileScrolling_Interval":options.callbacks.whileScrollingInterval,
/*events binding state*/
"bindEvent_scrollbar_click":false,
"bindEvent_mousewheel":false,
"bindEvent_focusin":false,
"bindEvent_buttonsContinuous_y":false,
"bindEvent_buttonsContinuous_x":false,
"bindEvent_buttonsPixels_y":false,
"bindEvent_buttonsPixels_x":false,
"bindEvent_scrollbar_touch":false,
"bindEvent_content_touch":false,
/*buttons intervals*/
"mCSB_buttonScrollRight":false,
"mCSB_buttonScrollLeft":false,
"mCSB_buttonScrollDown":false,
"mCSB_buttonScrollUp":false,
/*callback intervals*/
"whileScrolling":false
}).mCustomScrollbar("update");
/*detect max-width*/
if(options.horizontalScroll){
if($this.css("max-width")!=="none"){
if(!options.advanced.updateOnContentResize){ /*needs updateOnContentResize*/
options.advanced.updateOnContentResize=true;
}
$this.data({"mCS_maxWidth":parseInt($this.css("max-width")),"mCS_maxWidth_Interval":setInterval(function(){
if(mCSB_container.outerWidth()>$this.data("mCS_maxWidth")){
clearInterval($this.data("mCS_maxWidth_Interval"));
$this.mCustomScrollbar("update");
}
},150)});
}
}else{
/*detect max-height*/
if($this.css("max-height")!=="none"){
$this.data({"mCS_maxHeight":parseInt($this.css("max-height")),"mCS_maxHeight_Interval":setInterval(function(){
mCustomScrollBox.css("max-height",$this.data("mCS_maxHeight"));
if(mCSB_container.outerHeight()>$this.data("mCS_maxHeight")){
clearInterval($this.data("mCS_maxHeight_Interval"));
$this.mCustomScrollbar("update");
}
},150)});
}
}
/*window resize fn (for layouts based on percentages)*/
if(options.advanced.updateOnBrowserResize){
var mCSB_resizeTimeout;
$(window).resize(function(){
if(mCSB_resizeTimeout){
clearTimeout(mCSB_resizeTimeout);
}
mCSB_resizeTimeout=setTimeout(function(){
if(!$this.is(".mCS_disabled") && !$this.is(".mCS_destroyed")){
$this.mCustomScrollbar("update");
}
},150);
});
}
/*content resize fn (for dynamically generated content)*/
if(options.advanced.updateOnContentResize){
var mCSB_onContentResize;
if(options.horizontalScroll){
var mCSB_containerOldSize=mCSB_container.outerWidth();
}else{
var mCSB_containerOldSize=mCSB_container.outerHeight();
}
mCSB_onContentResize=setInterval(function(){
if(options.horizontalScroll){
if(options.advanced.autoExpandHorizontalScroll){
mCSB_container.css({"position":"absolute","width":"auto"}).wrap("<div class='mCSB_h_wrapper' style='position:relative; left:0; width:999999px;' />").css({"width":mCSB_container.outerWidth(),"position":"relative"}).unwrap();
}
var mCSB_containerNewSize=mCSB_container.outerWidth();
}else{
var mCSB_containerNewSize=mCSB_container.outerHeight();
}
if(mCSB_containerNewSize!=mCSB_containerOldSize){
$this.mCustomScrollbar("update");
mCSB_containerOldSize=mCSB_containerNewSize;
}
},300);
}
});
},
update:function(){
var $this=$(this),
mCustomScrollBox=$this.children(".mCustomScrollBox"),
mCSB_container=mCustomScrollBox.children(".mCSB_container");
mCSB_container.removeClass("mCS_no_scrollbar");
$this.removeClass("mCS_disabled mCS_destroyed");
mCustomScrollBox.scrollTop(0).scrollLeft(0); /*reset scrollTop/scrollLeft to prevent browser focus scrolling*/
var mCSB_scrollTools=mCustomScrollBox.children(".mCSB_scrollTools"),
mCSB_draggerContainer=mCSB_scrollTools.children(".mCSB_draggerContainer"),
mCSB_dragger=mCSB_draggerContainer.children(".mCSB_dragger");
if($this.data("horizontalScroll")){
var mCSB_buttonLeft=mCSB_scrollTools.children(".mCSB_buttonLeft"),
mCSB_buttonRight=mCSB_scrollTools.children(".mCSB_buttonRight"),
mCustomScrollBoxW=mCustomScrollBox.width();
if($this.data("autoExpandHorizontalScroll")){
mCSB_container.css({"position":"absolute","width":"auto"}).wrap("<div class='mCSB_h_wrapper' style='position:relative; left:0; width:999999px;' />").css({"width":mCSB_container.outerWidth(),"position":"relative"}).unwrap();
}
var mCSB_containerW=mCSB_container.outerWidth();
}else{
var mCSB_buttonUp=mCSB_scrollTools.children(".mCSB_buttonUp"),
mCSB_buttonDown=mCSB_scrollTools.children(".mCSB_buttonDown"),
mCustomScrollBoxH=mCustomScrollBox.height(),
mCSB_containerH=mCSB_container.outerHeight();
}
if(mCSB_containerH>mCustomScrollBoxH && !$this.data("horizontalScroll")){ /*content needs vertical scrolling*/
mCSB_scrollTools.css("display","block");
var mCSB_draggerContainerH=mCSB_draggerContainer.height();
/*auto adjust scrollbar dragger length analogous to content*/
if($this.data("autoDraggerLength")){
var draggerH=Math.round(mCustomScrollBoxH/mCSB_containerH*mCSB_draggerContainerH),
minDraggerH=mCSB_dragger.data("minDraggerHeight");
if(draggerH<=minDraggerH){ /*min dragger height*/
mCSB_dragger.css({"height":minDraggerH});
}else if(draggerH>=mCSB_draggerContainerH-10){ /*max dragger height*/
var mCSB_draggerContainerMaxH=mCSB_draggerContainerH-10;
mCSB_dragger.css({"height":mCSB_draggerContainerMaxH});
}else{
mCSB_dragger.css({"height":draggerH});
}
mCSB_dragger.children(".mCSB_dragger_bar").css({"line-height":mCSB_dragger.height()+"px"});
}
var mCSB_draggerH=mCSB_dragger.height(),
/*calculate and store scroll amount, add scrolling*/
scrollAmount=(mCSB_containerH-mCustomScrollBoxH)/(mCSB_draggerContainerH-mCSB_draggerH);
$this.data("scrollAmount",scrollAmount).mCustomScrollbar("scrolling",mCustomScrollBox,mCSB_container,mCSB_draggerContainer,mCSB_dragger,mCSB_buttonUp,mCSB_buttonDown,mCSB_buttonLeft,mCSB_buttonRight);
/*scroll*/
var mCSB_containerP=Math.abs(Math.round(mCSB_container.position().top));
$this.mCustomScrollbar("scrollTo",mCSB_containerP,{callback:false});
}else if(mCSB_containerW>mCustomScrollBoxW && $this.data("horizontalScroll")){ /*content needs horizontal scrolling*/
mCSB_scrollTools.css("display","block");
var mCSB_draggerContainerW=mCSB_draggerContainer.width();
/*auto adjust scrollbar dragger length analogous to content*/
if($this.data("autoDraggerLength")){
var draggerW=Math.round(mCustomScrollBoxW/mCSB_containerW*mCSB_draggerContainerW),
minDraggerW=mCSB_dragger.data("minDraggerWidth");
if(draggerW<=minDraggerW){ /*min dragger height*/
mCSB_dragger.css({"width":minDraggerW});
}else if(draggerW>=mCSB_draggerContainerW-10){ /*max dragger height*/
var mCSB_draggerContainerMaxW=mCSB_draggerContainerW-10;
mCSB_dragger.css({"width":mCSB_draggerContainerMaxW});
}else{
mCSB_dragger.css({"width":draggerW});
}
}
var mCSB_draggerW=mCSB_dragger.width(),
/*calculate and store scroll amount, add scrolling*/
scrollAmount=(mCSB_containerW-mCustomScrollBoxW)/(mCSB_draggerContainerW-mCSB_draggerW);
$this.data("scrollAmount",scrollAmount).mCustomScrollbar("scrolling",mCustomScrollBox,mCSB_container,mCSB_draggerContainer,mCSB_dragger,mCSB_buttonUp,mCSB_buttonDown,mCSB_buttonLeft,mCSB_buttonRight);
/*scroll*/
var mCSB_containerP=Math.abs(Math.round(mCSB_container.position().left));
$this.mCustomScrollbar("scrollTo",mCSB_containerP,{callback:false});
}else{ /*content does not need scrolling*/
/*unbind events, reset content position, hide scrollbars, remove classes*/
mCustomScrollBox.unbind("mousewheel focusin");
if($this.data("horizontalScroll")){
mCSB_dragger.add(mCSB_container).css("left",0);
}else{
mCSB_dragger.add(mCSB_container).css("top",0);
}
mCSB_scrollTools.css("display","none");
mCSB_container.addClass("mCS_no_scrollbar");
$this.data({"bindEvent_mousewheel":false,"bindEvent_focusin":false});
}
},
scrolling:function(mCustomScrollBox,mCSB_container,mCSB_draggerContainer,mCSB_dragger,mCSB_buttonUp,mCSB_buttonDown,mCSB_buttonLeft,mCSB_buttonRight){
var $this=$(this);
/*while scrolling callback*/
$this.mCustomScrollbar("callbacks","whileScrolling");
/*drag scrolling*/
if(!mCSB_dragger.hasClass("ui-draggable")){ /*apply drag function once*/
if($this.data("horizontalScroll")){
var draggableAxis="x";
}else{
var draggableAxis="y";
}
mCSB_dragger.draggable({
axis:draggableAxis,
containment:"parent",
drag:function(event,ui){
$this.mCustomScrollbar("scroll");
mCSB_dragger.addClass("mCSB_dragger_onDrag");
},
stop:function(event,ui){
mCSB_dragger.removeClass("mCSB_dragger_onDrag");
}
});
}
if(!$this.data("bindEvent_scrollbar_click")){ /*bind once*/
mCSB_draggerContainer.bind("click",function(e){
if($this.data("horizontalScroll")){
var mouseCoord=(e.pageX-mCSB_draggerContainer.offset().left);
if(mouseCoord<mCSB_dragger.position().left || mouseCoord>(mCSB_dragger.position().left+mCSB_dragger.width())){
var scrollToPos=mouseCoord;
if(scrollToPos>=mCSB_draggerContainer.width()-mCSB_dragger.width()){ /*max dragger position is bottom*/
scrollToPos=mCSB_draggerContainer.width()-mCSB_dragger.width();
}
mCSB_dragger.css("left",scrollToPos);
$this.mCustomScrollbar("scroll");
}
}else{
var mouseCoord=(e.pageY-mCSB_draggerContainer.offset().top);
if(mouseCoord<mCSB_dragger.position().top || mouseCoord>(mCSB_dragger.position().top+mCSB_dragger.height())){
var scrollToPos=mouseCoord;
if(scrollToPos>=mCSB_draggerContainer.height()-mCSB_dragger.height()){ /*max dragger position is bottom*/
scrollToPos=mCSB_draggerContainer.height()-mCSB_dragger.height();
}
mCSB_dragger.css("top",scrollToPos);
$this.mCustomScrollbar("scroll");
}
}
});
$this.data({"bindEvent_scrollbar_click":true});
}
/*mousewheel scrolling*/
if($this.data("mouseWheel")){
var mousewheelVel=$this.data("mouseWheel");
if($this.data("mouseWheel")==="auto"){
mousewheelVel=8; /*default mousewheel velocity*/
/*check for safari browser on mac osx to lower mousewheel velocity*/
var os=navigator.userAgent;
if(os.indexOf("Mac")!=-1 && os.indexOf("Safari")!=-1 && os.indexOf("AppleWebKit")!=-1 && os.indexOf("Chrome")==-1){
mousewheelVel=1;
}
}
if(!$this.data("bindEvent_mousewheel")){ /*bind once*/
mCustomScrollBox.bind("mousewheel",function(event,delta){
event.preventDefault();
var vel=Math.abs(delta*mousewheelVel);
if($this.data("horizontalScroll")){
if($this.data("mouseWheel")==="pixels"){
if(delta<0){
delta=-1;
}else{
delta=1;
}
var scrollTo=Math.abs(Math.round(mCSB_container.position().left))-(delta*$this.data("mouseWheelPixels"));
$this.mCustomScrollbar("scrollTo",scrollTo);
}else{
var posX=mCSB_dragger.position().left-(delta*vel);
mCSB_dragger.css("left",posX);
if(mCSB_dragger.position().left<0){
mCSB_dragger.css("left",0);
}
var mCSB_draggerContainerW=mCSB_draggerContainer.width(),
mCSB_draggerW=mCSB_dragger.width();
if(mCSB_dragger.position().left>mCSB_draggerContainerW-mCSB_draggerW){
mCSB_dragger.css("left",mCSB_draggerContainerW-mCSB_draggerW);
}
$this.mCustomScrollbar("scroll");
}
}else{
if($this.data("mouseWheel")==="pixels"){
if(delta<0){
delta=-1;
}else{
delta=1;
}
var scrollTo=Math.abs(Math.round(mCSB_container.position().top))-(delta*$this.data("mouseWheelPixels"));
$this.mCustomScrollbar("scrollTo",scrollTo);
}else{
var posY=mCSB_dragger.position().top-(delta*vel);
mCSB_dragger.css("top",posY);
if(mCSB_dragger.position().top<0){
mCSB_dragger.css("top",0);
}
var mCSB_draggerContainerH=mCSB_draggerContainer.height(),
mCSB_draggerH=mCSB_dragger.height();
if(mCSB_dragger.position().top>mCSB_draggerContainerH-mCSB_draggerH){
mCSB_dragger.css("top",mCSB_draggerContainerH-mCSB_draggerH);
}
$this.mCustomScrollbar("scroll");
}
}
});
$this.data({"bindEvent_mousewheel":true});
}
}
/*buttons scrolling*/
if($this.data("scrollButtons_enable")){
if($this.data("scrollButtons_scrollType")==="pixels"){ /*scroll by pixels*/
var pixelsScrollTo;
if($.browser.msie && parseInt($.browser.version)<9){ /*stupid ie8*/
$this.data("scrollInertia",0);
}
if($this.data("horizontalScroll")){
mCSB_buttonRight.add(mCSB_buttonLeft).unbind("mousedown touchstart onmsgesturestart mouseup mouseout touchend onmsgestureend",mCSB_buttonRight_stop,mCSB_buttonLeft_stop);
$this.data({"bindEvent_buttonsContinuous_x":false});
if(!$this.data("bindEvent_buttonsPixels_x")){ /*bind once*/
/*scroll right*/
mCSB_buttonRight.bind("click",function(e){
e.preventDefault();
if(!mCSB_container.is(":animated")){
pixelsScrollTo=Math.abs(mCSB_container.position().left)+$this.data("scrollButtons_scrollAmount");
$this.mCustomScrollbar("scrollTo",pixelsScrollTo);
}
});
/*scroll left*/
mCSB_buttonLeft.bind("click",function(e){
e.preventDefault();
if(!mCSB_container.is(":animated")){
pixelsScrollTo=Math.abs(mCSB_container.position().left)-$this.data("scrollButtons_scrollAmount");
if(mCSB_container.position().left>=-$this.data("scrollButtons_scrollAmount")){
pixelsScrollTo="left";
}
$this.mCustomScrollbar("scrollTo",pixelsScrollTo);
}
});
$this.data({"bindEvent_buttonsPixels_x":true});
}
}else{
mCSB_buttonDown.add(mCSB_buttonUp).unbind("mousedown touchstart onmsgesturestart mouseup mouseout touchend onmsgestureend",mCSB_buttonRight_stop,mCSB_buttonLeft_stop);
$this.data({"bindEvent_buttonsContinuous_y":false});
if(!$this.data("bindEvent_buttonsPixels_y")){ /*bind once*/
/*scroll down*/
mCSB_buttonDown.bind("click",function(e){
e.preventDefault();
if(!mCSB_container.is(":animated")){
pixelsScrollTo=Math.abs(mCSB_container.position().top)+$this.data("scrollButtons_scrollAmount");
$this.mCustomScrollbar("scrollTo",pixelsScrollTo);
}
});
/*scroll up*/
mCSB_buttonUp.bind("click",function(e){
e.preventDefault();
if(!mCSB_container.is(":animated")){
pixelsScrollTo=Math.abs(mCSB_container.position().top)-$this.data("scrollButtons_scrollAmount");
if(mCSB_container.position().top>=-$this.data("scrollButtons_scrollAmount")){
pixelsScrollTo="top";
}
$this.mCustomScrollbar("scrollTo",pixelsScrollTo);
}
});
$this.data({"bindEvent_buttonsPixels_y":true});
}
}
}else{ /*continuous scrolling*/
if($this.data("horizontalScroll")){
mCSB_buttonRight.add(mCSB_buttonLeft).unbind("click");
$this.data({"bindEvent_buttonsPixels_x":false});
if(!$this.data("bindEvent_buttonsContinuous_x")){ /*bind once*/
/*scroll right*/
mCSB_buttonRight.bind("mousedown touchstart onmsgesturestart",function(e){
e.preventDefault();
e.stopPropagation();
$this.data({"mCSB_buttonScrollRight":setInterval(function(){
var scrollTo=Math.round((Math.abs(Math.round(mCSB_container.position().left))+$this.data("scrollButtons_scrollSpeed"))/$this.data("scrollAmount"));
$this.mCustomScrollbar("scrollTo",scrollTo,{moveDragger:true});
},30)});
});
var mCSB_buttonRight_stop=function(e){
e.preventDefault();
e.stopPropagation();
clearInterval($this.data("mCSB_buttonScrollRight"));
}
mCSB_buttonRight.bind("mouseup touchend onmsgestureend mouseout",mCSB_buttonRight_stop);
/*scroll left*/
mCSB_buttonLeft.bind("mousedown touchstart onmsgesturestart",function(e){
e.preventDefault();
e.stopPropagation();
$this.data({"mCSB_buttonScrollLeft":setInterval(function(){
var scrollTo=Math.round((Math.abs(Math.round(mCSB_container.position().left))-$this.data("scrollButtons_scrollSpeed"))/$this.data("scrollAmount"));
$this.mCustomScrollbar("scrollTo",scrollTo,{moveDragger:true});
},30)});
});
var mCSB_buttonLeft_stop=function(e){
e.preventDefault();
e.stopPropagation();
clearInterval($this.data("mCSB_buttonScrollLeft"));
}
mCSB_buttonLeft.bind("mouseup touchend onmsgestureend mouseout",mCSB_buttonLeft_stop);
$this.data({"bindEvent_buttonsContinuous_x":true});
}
}else{
mCSB_buttonDown.add(mCSB_buttonUp).unbind("click");
$this.data({"bindEvent_buttonsPixels_y":false});
if(!$this.data("bindEvent_buttonsContinuous_y")){ /*bind once*/
/*scroll down*/
mCSB_buttonDown.bind("mousedown touchstart onmsgesturestart",function(e){
e.preventDefault();
e.stopPropagation();
$this.data({"mCSB_buttonScrollDown":setInterval(function(){
var scrollTo=Math.round((Math.abs(Math.round(mCSB_container.position().top))+$this.data("scrollButtons_scrollSpeed"))/$this.data("scrollAmount"));
$this.mCustomScrollbar("scrollTo",scrollTo,{moveDragger:true});
},30)});
});
var mCSB_buttonDown_stop=function(e){
e.preventDefault();
e.stopPropagation();
clearInterval($this.data("mCSB_buttonScrollDown"));
}
mCSB_buttonDown.bind("mouseup touchend onmsgestureend mouseout",mCSB_buttonDown_stop);
/*scroll up*/
mCSB_buttonUp.bind("mousedown touchstart onmsgesturestart",function(e){
e.preventDefault();
e.stopPropagation();
$this.data({"mCSB_buttonScrollUp":setInterval(function(){
var scrollTo=Math.round((Math.abs(Math.round(mCSB_container.position().top))-$this.data("scrollButtons_scrollSpeed"))/$this.data("scrollAmount"));
$this.mCustomScrollbar("scrollTo",scrollTo,{moveDragger:true});
},30)});
});
var mCSB_buttonUp_stop=function(e){
e.preventDefault();
e.stopPropagation();
clearInterval($this.data("mCSB_buttonScrollUp"));
}
mCSB_buttonUp.bind("mouseup touchend onmsgestureend mouseout",mCSB_buttonUp_stop);
$this.data({"bindEvent_buttonsContinuous_y":true});
}
}
}
}
/*scrolling on element focus (e.g. via TAB key)*/
if($this.data("autoScrollOnFocus")){
if(!$this.data("bindEvent_focusin")){ /*bind once*/
mCustomScrollBox.bind("focusin",function(){
mCustomScrollBox.scrollTop(0).scrollLeft(0);
var focusedElem=$(document.activeElement);
if(focusedElem.is("input,textarea,select,button,a[tabindex],area,object")){
if($this.data("horizontalScroll")){
var mCSB_containerX=mCSB_container.position().left,
focusedElemX=focusedElem.position().left,
mCustomScrollBoxW=mCustomScrollBox.width(),
focusedElemW=focusedElem.outerWidth();
if(mCSB_containerX+focusedElemX>=0 && mCSB_containerX+focusedElemX<=mCustomScrollBoxW-focusedElemW){
/*just focus...*/
}else{ /*scroll, then focus*/
var moveDragger=focusedElemX/$this.data("scrollAmount");
if(moveDragger>=mCSB_draggerContainer.width()-mCSB_dragger.width()){ /*max dragger position is bottom*/
moveDragger=mCSB_draggerContainer.width()-mCSB_dragger.width();
}
mCSB_dragger.css("left",moveDragger);
$this.mCustomScrollbar("scroll");
}
}else{
var mCSB_containerY=mCSB_container.position().top,
focusedElemY=focusedElem.position().top,
mCustomScrollBoxH=mCustomScrollBox.height(),
focusedElemH=focusedElem.outerHeight();
if(mCSB_containerY+focusedElemY>=0 && mCSB_containerY+focusedElemY<=mCustomScrollBoxH-focusedElemH){
/*just focus...*/
}else{ /*scroll, then focus*/
var moveDragger=focusedElemY/$this.data("scrollAmount");
if(moveDragger>=mCSB_draggerContainer.height()-mCSB_dragger.height()){ /*max dragger position is bottom*/
moveDragger=mCSB_draggerContainer.height()-mCSB_dragger.height();
}
mCSB_dragger.css("top",moveDragger);
$this.mCustomScrollbar("scroll");
}
}
}
});
$this.data({"bindEvent_focusin":true});
}
}
/*touch events*/
if($(document).data("mCS-is-touch-device")){
/*scrollbar touch-drag*/
if(!$this.data("bindEvent_scrollbar_touch")){ /*bind once*/
var mCSB_draggerTouchY,
mCSB_draggerTouchX;
mCSB_dragger.bind("touchstart onmsgesturestart",function(e){
e.preventDefault();
e.stopPropagation();
var touch=e.originalEvent.touches[0] || e.originalEvent.changedTouches[0],
elem=$(this),
elemOffset=elem.offset(),
x=touch.pageX-elemOffset.left,
y=touch.pageY-elemOffset.top;
if(x<elem.width() && x>0 && y<elem.height() && y>0){
mCSB_draggerTouchY=y;
mCSB_draggerTouchX=x;
}
});
mCSB_dragger.bind("touchmove onmsgesturechange",function(e){
e.preventDefault();
e.stopPropagation();
var touch=e.originalEvent.touches[0] || e.originalEvent.changedTouches[0],
elem=$(this),
elemOffset=elem.offset(),
x=touch.pageX-elemOffset.left,
y=touch.pageY-elemOffset.top;
if($this.data("horizontalScroll")){
$this.mCustomScrollbar("scrollTo",(mCSB_dragger.position().left-(mCSB_draggerTouchX))+x,{moveDragger:true});
}else{
$this.mCustomScrollbar("scrollTo",(mCSB_dragger.position().top-(mCSB_draggerTouchY))+y,{moveDragger:true});
}
});
$this.data({"bindEvent_scrollbar_touch":true});
}
/*content touch-drag*/
if(!$this.data("bindEvent_content_touch")){ /*bind once*/
var touch,
elem,
elemOffset,
x,
y,
mCSB_containerTouchY,
mCSB_containerTouchX;
mCSB_container.bind("touchstart onmsgesturestart",function(e){
touch=e.originalEvent.touches[0] || e.originalEvent.changedTouches[0];
elem=$(this);
elemOffset=elem.offset();
x=touch.pageX-elemOffset.left;
y=touch.pageY-elemOffset.top;
mCSB_containerTouchY=y;
mCSB_containerTouchX=x;
});
mCSB_container.bind("touchmove onmsgesturechange",function(e){
e.preventDefault();
e.stopPropagation();
touch=e.originalEvent.touches[0] || e.originalEvent.changedTouches[0];
elem=$(this).parent();
elemOffset=elem.offset();
x=touch.pageX-elemOffset.left;
y=touch.pageY-elemOffset.top;
if($this.data("horizontalScroll")){
$this.mCustomScrollbar("scrollTo",mCSB_containerTouchX-x);
}else{
$this.mCustomScrollbar("scrollTo",mCSB_containerTouchY-y);
}
});
$this.data({"bindEvent_content_touch":true});
}
}
},
scroll:function(bypassCallbacks){
var $this=$(this),
mCSB_dragger=$this.find(".mCSB_dragger"),
mCSB_container=$this.find(".mCSB_container"),
mCustomScrollBox=$this.find(".mCustomScrollBox");
if($this.data("horizontalScroll")){
var draggerX=mCSB_dragger.position().left,
targX=-draggerX*$this.data("scrollAmount"),
thisX=mCSB_container.position().left,
posX=Math.round(thisX-targX);
}else{
var draggerY=mCSB_dragger.position().top,
targY=-draggerY*$this.data("scrollAmount"),
thisY=mCSB_container.position().top,
posY=Math.round(thisY-targY);
}
if($.browser.webkit){ /*fix webkit zoom and jquery animate*/
var screenCssPixelRatio=(window.outerWidth-8)/window.innerWidth,
isZoomed=(screenCssPixelRatio<.98 || screenCssPixelRatio>1.02);
}
if($this.data("scrollInertia")===0 || isZoomed){
if(!bypassCallbacks){
$this.mCustomScrollbar("callbacks","onScrollStart"); /*user custom callback functions*/
}
if($this.data("horizontalScroll")){
mCSB_container.css("left",targX);
}else{
mCSB_container.css("top",targY);
}
if(!bypassCallbacks){
/*user custom callback functions*/
if($this.data("whileScrolling")){
$this.data("whileScrolling_Callback").call();
}
$this.mCustomScrollbar("callbacks","onScroll");
}
$this.data({"mCS_Init":false});
}else{
if(!bypassCallbacks){
$this.mCustomScrollbar("callbacks","onScrollStart"); /*user custom callback functions*/
}
if($this.data("horizontalScroll")){
mCSB_container.stop().animate({left:"-="+posX},$this.data("scrollInertia"),$this.data("scrollEasing"),function(){
if(!bypassCallbacks){
$this.mCustomScrollbar("callbacks","onScroll"); /*user custom callback functions*/
}
$this.data({"mCS_Init":false});
});
}else{
mCSB_container.stop().animate({top:"-="+posY},$this.data("scrollInertia"),$this.data("scrollEasing"),function(){
if(!bypassCallbacks){
$this.mCustomScrollbar("callbacks","onScroll"); /*user custom callback functions*/
}
$this.data({"mCS_Init":false});
});
}
}
},
scrollTo:function(scrollTo,options){
var defaults={
moveDragger:false,
callback:true
},
options=$.extend(defaults,options),
$this=$(this),
scrollToPos,
mCustomScrollBox=$this.find(".mCustomScrollBox"),
mCSB_container=mCustomScrollBox.children(".mCSB_container"),
mCSB_draggerContainer=$this.find(".mCSB_draggerContainer"),
mCSB_dragger=mCSB_draggerContainer.children(".mCSB_dragger"),
targetPos;
if(scrollTo || scrollTo===0){
if(typeof(scrollTo)==="number"){ /*if integer, scroll by number of pixels*/
if(options.moveDragger){ /*scroll dragger*/
scrollToPos=scrollTo;
}else{ /*scroll content by default*/
targetPos=scrollTo;
scrollToPos=Math.round(targetPos/$this.data("scrollAmount"));
}
}else if(typeof(scrollTo)==="string"){ /*if string, scroll by element position*/
var target;
if(scrollTo==="top"){ /*scroll to top*/
target=0;
}else if(scrollTo==="bottom" && !$this.data("horizontalScroll")){ /*scroll to bottom*/
target=mCSB_container.outerHeight()-mCustomScrollBox.height();
}else if(scrollTo==="left"){ /*scroll to left*/
target=0;
}else if(scrollTo==="right" && $this.data("horizontalScroll")){ /*scroll to right*/
target=mCSB_container.outerWidth()-mCustomScrollBox.width();
}else if(scrollTo==="first"){ /*scroll to first element position*/
target=$this.find(".mCSB_container").find(":first");
}else if(scrollTo==="last"){ /*scroll to last element position*/
target=$this.find(".mCSB_container").find(":last");
}else{ /*scroll to element position*/
target=$this.find(scrollTo);
}
if(target.length===1){ /*if such unique element exists, scroll to it*/
if($this.data("horizontalScroll")){
targetPos=target.position().left;
}else{
targetPos=target.position().top;
}
scrollToPos=Math.ceil(targetPos/$this.data("scrollAmount"));
}else{
scrollToPos=target;
}
}
/*scroll to*/
if(scrollToPos<0){
scrollToPos=0;
}
if($this.data("horizontalScroll")){
if(scrollToPos>=mCSB_draggerContainer.width()-mCSB_dragger.width()){ /*max dragger position is bottom*/
scrollToPos=mCSB_draggerContainer.width()-mCSB_dragger.width();
}
mCSB_dragger.css("left",scrollToPos);
}else{
if(scrollToPos>=mCSB_draggerContainer.height()-mCSB_dragger.height()){ /*max dragger position is bottom*/
scrollToPos=mCSB_draggerContainer.height()-mCSB_dragger.height();
}
mCSB_dragger.css("top",scrollToPos);
}
if(options.callback){
$this.mCustomScrollbar("scroll",false);
}else{
$this.mCustomScrollbar("scroll",true);
}
}
},
callbacks:function(callback){
var $this=$(this),
mCustomScrollBox=$this.find(".mCustomScrollBox"),
mCSB_container=$this.find(".mCSB_container");
switch(callback){
/*start scrolling callback*/
case "onScrollStart":
if(!mCSB_container.is(":animated")){
$this.data("onScrollStart_Callback").call();
}
break;
/*end scrolling callback*/
case "onScroll":
if($this.data("horizontalScroll")){
var mCSB_containerX=Math.round(mCSB_container.position().left);
if(mCSB_containerX<0 && mCSB_containerX<=mCustomScrollBox.width()-mCSB_container.outerWidth()+$this.data("onTotalScroll_Offset")){
$this.data("onTotalScroll_Callback").call();
}else if(mCSB_containerX>=-$this.data("onTotalScroll_Offset")){
$this.data("onTotalScrollBack_Callback").call();
}else{
$this.data("onScroll_Callback").call();
}
}else{
var mCSB_containerY=Math.round(mCSB_container.position().top);
if(mCSB_containerY<0 && mCSB_containerY<=mCustomScrollBox.height()-mCSB_container.outerHeight()+$this.data("onTotalScroll_Offset")){
$this.data("onTotalScroll_Callback").call();
}else if(mCSB_containerY>=-$this.data("onTotalScroll_Offset")){
$this.data("onTotalScrollBack_Callback").call();
}else{
$this.data("onScroll_Callback").call();
}
}
break;
/*while scrolling callback*/
case "whileScrolling":
if($this.data("whileScrolling_Callback") && !$this.data("whileScrolling")){
$this.data({"whileScrolling":setInterval(function(){
if(mCSB_container.is(":animated") && !$this.data("mCS_Init")){
$this.data("whileScrolling_Callback").call();
}
},$this.data("whileScrolling_Interval"))});
}
break;
}
},
disable:function(resetScroll){
var $this=$(this),
mCustomScrollBox=$this.children(".mCustomScrollBox"),
mCSB_container=mCustomScrollBox.children(".mCSB_container"),
mCSB_scrollTools=mCustomScrollBox.children(".mCSB_scrollTools"),
mCSB_dragger=mCSB_scrollTools.find(".mCSB_dragger");
mCustomScrollBox.unbind("mousewheel focusin");
if(resetScroll){
if($this.data("horizontalScroll")){
mCSB_dragger.add(mCSB_container).css("left",0);
}else{
mCSB_dragger.add(mCSB_container).css("top",0);
}
}
mCSB_scrollTools.css("display","none");
mCSB_container.addClass("mCS_no_scrollbar");
$this.data({"bindEvent_mousewheel":false,"bindEvent_focusin":false}).addClass("mCS_disabled");
},
destroy:function(){
var $this=$(this),
content=$this.find(".mCSB_container").html();
$this.find(".mCustomScrollBox").remove();
$this.html(content).removeClass("mCustomScrollbar _mCS_"+$(document).data("mCustomScrollbar-index")).addClass("mCS_destroyed");
}
}
$.fn.mCustomScrollbar=function(method){
if(methods[method]){
return methods[method].apply(this,Array.prototype.slice.call(arguments,1));
}else if(typeof method==="object" || !method){
return methods.init.apply(this,arguments);
}else{
$.error("Method "+method+" does not exist");
}
};
})(jQuery);
/*iOS 6 bug fix
iOS 6 suffers from a bug that kills timers that are created while a page is scrolling.
The following fixes that problem by recreating timers after scrolling finishes (with interval correction).*/
var iOSVersion=iOSVersion();
if(iOSVersion>=6){
(function(h){var a={};var d={};var e=h.setTimeout;var f=h.setInterval;var i=h.clearTimeout;var c=h.clearInterval;if(!h.addEventListener){return false}function j(q,n,l){var p,k=l[0],m=(q===f);function o(){if(k){k.apply(h,arguments);if(!m){delete n[p];k=null}}}l[0]=o;p=q.apply(h,l);n[p]={args:l,created:Date.now(),cb:k,id:p};return p}function b(q,o,k,r,t){var l=k[r];if(!l){return}var m=(q===f);o(l.id);if(!m){var n=l.args[1];var p=Date.now()-l.created;if(p<0){p=0}n-=p;if(n<0){n=0}l.args[1]=n}function s(){if(l.cb){l.cb.apply(h,arguments);if(!m){delete k[r];l.cb=null}}}l.args[0]=s;l.created=Date.now();l.id=q.apply(h,l.args)}h.setTimeout=function(){return j(e,a,arguments)};h.setInterval=function(){return j(f,d,arguments)};h.clearTimeout=function(l){var k=a[l];if(k){delete a[l];i(k.id)}};h.clearInterval=function(l){var k=d[l];if(k){delete d[l];c(k.id)}};var g=h;while(g.location!=g.parent.location){g=g.parent}g.addEventListener("scroll",function(){var k;for(k in a){b(e,i,a,k)}for(k in d){b(f,c,d,k)}})}(window));
}
function iOSVersion(){
var agent=window.navigator.userAgent,
start=agent.indexOf('OS ');
if((agent.indexOf('iPhone')>-1 || agent.indexOf('iPad')>-1) && start>-1){
return window.Number(agent.substr(start+3,3).replace('_','.'));
}
return 0;
}

12
lib/dashboard/js/jquery.mousewheel.min.js

@ -1,12 +0,0 @@
/*! Copyright (c) 2011 Brandon Aaron (http://brandonaaron.net)
* Licensed under the MIT License (LICENSE.txt).
*
* Thanks to: http://adomas.org/javascript-mouse-wheel/ for some pointers.
* Thanks to: Mathias Bank(http://www.mathias-bank.de) for a scope bug fix.
* Thanks to: Seamus Leahy for adding deltaX and deltaY
*
* Version: 3.0.6
*
* Requires: 1.2.2+
*/
(function(a){function d(b){var c=b||window.event,d=[].slice.call(arguments,1),e=0,f=!0,g=0,h=0;return b=a.event.fix(c),b.type="mousewheel",c.wheelDelta&&(e=c.wheelDelta/120),c.detail&&(e=-c.detail/3),h=e,c.axis!==undefined&&c.axis===c.HORIZONTAL_AXIS&&(h=0,g=-1*e),c.wheelDeltaY!==undefined&&(h=c.wheelDeltaY/120),c.wheelDeltaX!==undefined&&(g=-1*c.wheelDeltaX/120),d.unshift(b,e,g,h),(a.event.dispatch||a.event.handle).apply(this,d)}var b=["DOMMouseScroll","mousewheel"];if(a.event.fixHooks)for(var c=b.length;c;)a.event.fixHooks[b[--c]]=a.event.mouseHooks;a.event.special.mousewheel={setup:function(){if(this.addEventListener)for(var a=b.length;a;)this.addEventListener(b[--a],d,!1);else this.onmousewheel=d},teardown:function(){if(this.removeEventListener)for(var a=b.length;a;)this.removeEventListener(b[--a],d,!1);else this.onmousewheel=null}},a.fn.extend({mousewheel:function(a){return a?this.bind("mousewheel",a):this.trigger("mousewheel")},unmousewheel:function(a){return this.unbind("mousewheel",a)}})})(jQuery)

BIN
lib/dashboard/webfonts/22AE77_0_0.eot

3
lib/dashboard/webfonts/22AE77_0_0.ttf

@ -1,3 +0,0 @@
<!-- saved from url=(0048)http://www-cdn.jtvnw.net/webfonts/22AE77_0_0.ttf -->
<html><body><div class="webkit-line-gutter-backdrop"></div><table><tbody><tr><td class="webkit-line-number"></td><td class="webkit-line-content"> <span class="webkit-html-attribute-name">Ö°Í°</span>/<span class="webkit-html-attribute-name">°.Ͳ.</span></td></tr><tr><td class="webkit-line-number"></td><td class="webkit-line-content"><span class="webkit-html-attribute-name">+³@</span> <span class="webkit-html-attribute-name">+° 2±2+±°

3
lib/dashboard/webfonts/22AE77_0_0.woff

@ -1,3 +0,0 @@
<!-- saved from url=(0049)http://www-cdn.jtvnw.net/webfonts/22AE77_0_0.woff -->
<html><body><div class="webkit-line-gutter-backdrop"></div><table><tbody><tr><td class="webkit-line-number"></td><td class="webkit-line-content">wOFF

BIN
lib/dashboard/webfonts/scoolar_tfb.eot

BIN
lib/dashboard/webfonts/scoolar_tfb.ttf

Loading…
Cancel
Save