forked from 4ducky/4ducky
249 lines
6.6 KiB
JavaScript
249 lines
6.6 KiB
JavaScript
// JavaScript Document
|
|
|
|
if (/iPhone|iPod|iPad|Android|BlackBerry/i.test(navigator.userAgent)){
|
|
jQuery(document).ready(function(){
|
|
jQuery("#sidebar").hide(); jQuery("#site").css("margin-right","0px");
|
|
jQuery("#footer").css("margin-right","0px");
|
|
jQuery("#MenuRightBlock").css("display","none");
|
|
jQuery("#menu").css("position","relative");
|
|
jQuery("#content").css("margin-top","0.5em");
|
|
jQuery("#footer-back-to-top").css("right","30px");
|
|
});
|
|
};
|
|
|
|
jQuery(document).ready(function () {
|
|
if ( jQuery(".score span").width() > "75" ) {
|
|
jQuery(".score span").css("background-color","red");
|
|
}
|
|
else if ( jQuery(".score span").width() > "50" ) {
|
|
jQuery(".score span").css("background-color","orangeRed");
|
|
}
|
|
else if ( jQuery(".score span").width() > "25" ) {
|
|
jQuery(".score span").css("background-color","yellowGreen");
|
|
}
|
|
});
|
|
|
|
function toggle(obj) {
|
|
var el = document.getElementById(obj);
|
|
if ( el.style.display != 'block' ) {
|
|
el.style.display = 'block';
|
|
} else {
|
|
el.style.display = 'none';
|
|
}
|
|
}
|
|
|
|
function BBcode(code){
|
|
var input = prompt("Enter URL / text / image-link / youtube-link");
|
|
|
|
if (input.value == ""){
|
|
return;
|
|
}
|
|
else{
|
|
if (code == "link"){
|
|
var x = document.getElementById("content_comment");
|
|
x.value = x.value + "[link]" + input + "[/link]";
|
|
}
|
|
else if (code == "youtube"){
|
|
var x = document.getElementById("content_comment");
|
|
x.value = x.value + "[youtube]" + input + "[/youtube]";
|
|
}
|
|
else if (code == "img"){
|
|
var x = document.getElementById("content_comment");
|
|
x.value = x.value + "[img]" + input + "[/img]";
|
|
}
|
|
else if (code == "spoiler"){
|
|
var x = document.getElementById("content_comment");
|
|
x.value = x.value + "[spoiler]" + input + "[/spoiler]";
|
|
}
|
|
}
|
|
}
|
|
|
|
function reComment(commentId,user) {
|
|
document.getElementById("comment" + commentId).style.border = "1px solid #898989";
|
|
var output = document.getElementById(commentId).innerText;
|
|
output = document.getElementById(commentId).textContent;
|
|
output = ">> " + user + ": \n\"" + output + "\"";
|
|
document.getElementById("content_comment").value = document.getElementById("content_comment").value + "[quote]" + output.substr(0, 750) + "[/quote]\n";
|
|
}
|
|
|
|
jQuery(document).ready(function () {
|
|
jQuery("#rightpanel").slimScroll({
|
|
height: "100%",
|
|
width: "180px"
|
|
});
|
|
});
|
|
|
|
jQuery(document).ready(function () {
|
|
jQuery("#footer-back-to-top").hide();
|
|
jQuery(function () {
|
|
jQuery(window).scroll(function () {
|
|
if (jQuery(this).scrollTop() > 200) {
|
|
jQuery("#footer-back-to-top").fadeIn('slow');
|
|
} else {
|
|
jQuery("#footer-back-to-top").fadeOut('slow');
|
|
}
|
|
});
|
|
});
|
|
});
|
|
|
|
jQuery(document).ready(function(){
|
|
var side = jQuery.cookie("close_sidebar") == "yes";
|
|
if( side ) {
|
|
jQuery("#sidebar").hide();
|
|
jQuery("#MenuRightBlock").hide();
|
|
jQuery("#site").css("margin-right","0px");
|
|
jQuery("#footer").css("margin-right","0px");
|
|
jQuery("#footer-back-to-top").css("right","30px");
|
|
}
|
|
|
|
var side = jQuery.cookie("close_message") == "yes";
|
|
if( side ) { jQuery("#dolan").hide(); }
|
|
});
|
|
|
|
jQuery(document).ready(function(){
|
|
jQuery("#x").click(function () {
|
|
jQuery("#sidebar").fadeOut("slow");
|
|
jQuery("#MenuRightBlock").hide();
|
|
jQuery("#site").css("margin-right","0px");
|
|
jQuery("#footer").css("margin-right","0px");
|
|
jQuery("#footer-back-to-top").css("right","30px");
|
|
alert ("Sidebar closed. Open it by clicking on your avatar in the header. Best regards, Dolan!");
|
|
jQuery.cookie("close_sidebar","yes", {path: '/'});
|
|
});
|
|
});
|
|
|
|
jQuery(document).ready(function(){
|
|
jQuery("#stfu").click(function () {
|
|
jQuery("#dolan").fadeOut("slow");
|
|
jQuery.cookie("close_message","yes", {path: '/'});
|
|
});
|
|
});
|
|
|
|
jQuery(document).ready(function(){
|
|
jQuery("#del_cookie").click(function () {
|
|
jQuery.cookie("close_sidebar",null, {path: '/'});
|
|
jQuery.cookie("close_message",null, {path: '/'});
|
|
location.reload();
|
|
});
|
|
});
|
|
|
|
jQuery(document).ready(function() {
|
|
jQuery("#loadcom").click(function() {
|
|
LoadData("lastcomments","rightpanel");
|
|
}).click();
|
|
});
|
|
|
|
jQuery(document.documentElement).keyup(function (event) {
|
|
if (jQuery("#prevBar").length > 0) {
|
|
if (!jQuery("#content_comment").val()) {
|
|
// handle cursor keys
|
|
if (event.keyCode == 37) {
|
|
window.open(jQuery("#prevBar").attr('href'),'_self')
|
|
} else if (event.keyCode == 39) {
|
|
window.open(jQuery("#nextBar").attr('href'),'_self')
|
|
}
|
|
}
|
|
}
|
|
});
|
|
|
|
function toggleDiv(id,flagit) {
|
|
if (flagit=="1"){
|
|
if (document.layers) document.layers[''+id+''].visibility = "show"
|
|
else if (document.all) document.all[''+id+''].style.visibility = "visible"
|
|
else if (document.getElementById) document.getElementById(''+id+'').style.visibility = "visible"
|
|
}else
|
|
if (flagit=="0"){
|
|
if (document.layers) document.layers[''+id+''].visibility = "hide"
|
|
else if (document.all) document.all[''+id+''].style.visibility = "hidden"
|
|
else if (document.getElementById) document.getElementById(''+id+'').style.visibility = "hidden"
|
|
}}
|
|
|
|
jQuery.fn.preloader = function(options){
|
|
|
|
var defaults = {
|
|
delay:100,
|
|
preload_parent:"a",
|
|
check_timer:100,
|
|
ondone:function(){ },
|
|
oneachload:function(image){ },
|
|
fadein:1000
|
|
};
|
|
|
|
// variables declaration and precaching images and parent container
|
|
var options = jQuery.extend(defaults, options),
|
|
root = jQuery(this) , images = root.find("img") , timer , counter = 0, i=0 , checkFlag = [] , delaySum = options.delay ,
|
|
|
|
init = function(){
|
|
|
|
timer = setInterval(function(){
|
|
|
|
if(counter>=checkFlag.length)
|
|
{
|
|
clearInterval(timer);
|
|
options.ondone();
|
|
return;
|
|
}
|
|
|
|
for(i=0;i<images.length;i++)
|
|
{
|
|
if(images[i].complete==true)
|
|
{
|
|
if(checkFlag[i]==false)
|
|
{
|
|
checkFlag[i] = true;
|
|
options.oneachload(images[i]);
|
|
counter++;
|
|
|
|
delaySum = delaySum + options.delay;
|
|
}
|
|
|
|
jQuery(images[i]).css("display","block").delay(delaySum).animate({opacity:1},options.fadein,
|
|
function(){ jQuery(this).parent().removeClass("preloader"); });
|
|
|
|
|
|
|
|
|
|
}
|
|
}
|
|
|
|
},options.check_timer)
|
|
|
|
|
|
} ;
|
|
|
|
images.each(function(){
|
|
|
|
if(jQuery(this).parent(options.preload_parent).length==0)
|
|
jQuery(this).wrap("<a class='preloader' />");
|
|
else
|
|
jQuery(this).parent().addClass("preloader");
|
|
|
|
checkFlag[i++] = false;
|
|
|
|
|
|
});
|
|
images = jQuery.makeArray(images);
|
|
|
|
|
|
var icon = jQuery("<img />",{
|
|
|
|
id : 'loadingicon' ,
|
|
src : 'css/i/89.gif'
|
|
|
|
}).hide().appendTo("body");
|
|
|
|
|
|
|
|
timer = setInterval(function(){
|
|
|
|
if(icon[0].complete==true)
|
|
{
|
|
clearInterval(timer);
|
|
init();
|
|
icon.remove();
|
|
return;
|
|
}
|
|
|
|
},100);
|
|
|
|
} |