commit
This commit is contained in:
commit
ec2e35c117
343 files changed
+13615
No files matched your search
@@ -0,0 +1,21 @@
|
||||
<!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>
|
||||
@@ -0,0 +1,191 @@
|
||||
@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;}
|
||||
@@ -0,0 +1,208 @@
|
||||
/* 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 */
|
||||
}
|
||||
@@ -0,0 +1,85 @@
|
||||
<!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>
|
||||
@@ -0,0 +1,175 @@
|
||||
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);
|
||||
};
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 14 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 80 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 18 KiB |
Whitespace-only changes.
Binary file not shown.
|
After Width: | Height: | Size: 195 KiB |
@@ -0,0 +1,167 @@
|
||||
//-------- 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] + ' </span>');
|
||||
break;
|
||||
case 'RECV':
|
||||
data.splice(0, 1, '<span class="nick" style="color:red">' + data[0] + ' </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);
|
||||
@@ -0,0 +1,874 @@
|
||||
/*
|
||||
== 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
@@ -0,0 +1,12 @@
|
||||
/*! 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)
|
||||
Binary file not shown.
@@ -0,0 +1,3 @@
|
||||
|
||||
<!-- 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+±°
|
||||
@@ -0,0 +1,3 @@
|
||||
|
||||
<!-- 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
|
||||
Binary file not shown.
Binary file not shown.
Reference in new issue
Block a user