Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*#Credits to Graou this sb.js*/
- function toggleSB() {
- if(document.getElementById("shoutbox_e").style.display == "none") {return "lolnope";}
- var size = document.getElementById("shoutbox_data").scrollHeight + "px";
- var exButton = document.getElementById("datToggle");
- var height = document.getElementById("shoutbox_data").style.height;
- if(height == SBContractSize) {
- document.getElementById("shoutbox_data").style.height = size;
- exButton.innerHTML = "Contract ShoutBox";
- } else if(height >= size) {
- document.getElementById("shoutbox_data").style.height = SBContractSize;
- exButton.innerHTML = "Expand ShoutBox";
- } else if(height < size) {
- SBContractSize = document.getElementById("shoutbox_data").style.height;
- }
- }
- function toggleSBDisplay() {
- if(document.getElementById("shoutbox_e").style.display == "none") {
- SBRuleNonButtonClick = 1;
- SBDisplay();
- } else {
- document.getElementById("AcceptButton").parentNode.style.display = "none";
- }
- }
- function isIE11() {
- if (navigator.userAgent.indexOf('MSIE') !== -1 || navigator.appVersion.indexOf('Trident/') > 0) {
- if (!(window.ActiveXObject) && "ActiveXObject") {
- return true;
- } else {return false;}
- } else {return false;}
- }
- function getCookieSBDisplay() {
- var name = "WeepForumShoutboxDisplay=";
- var cookArray = document.cookie.split(';');
- for(var i=0; i<cookArray.length; i++) {
- var cook = cookArray[i];
- while (cook.charAt(0)==' '){
- cook = cook.substring(1);
- }
- if (cook.indexOf(name) != -1) {
- return cook.substring(name.length,cook.length);
- }
- }
- return false;
- }
- function setCookieSBDisplay(cookValue) {
- var name = "WeepForumShoutboxDisplay=";
- var cookArray = document.cookie.split(';');
- for(var i=0; i<cookArray.length; i++) {
- var cook = cookArray[i];
- while (cook.charAt(0)==' '){
- cook = cook.substring(1);
- }
- if (cook.indexOf(name) != -1) {
- var toReplace = name + cook.substring(name.length,cook.length);
- var replacement = name + cookValue;
- document.cookie = document.cookie.replace(toReplace, replacement);
- return true;
- }
- }
- document.cookie += '; WeepForumShoutboxDisplay='+cookValue+';';
- return false;
- }
- function LoadSBDisplay() {
- if(typeof(Storage) !== "undefined") {
- if(!localStorage.getItem("PrefDisplaySB")) {
- localStorage.setItem("PrefDisplaySB", 0);
- var SBDisplayPref = 0;
- } else {
- var SBDisplayPref = localStorage.getItem("PrefDisplaySB");
- }
- } else {
- if(!getCookieSBDisplay()) {
- setCookieSBDisplay(0);
- var SBDisplayPref = 0;
- } else {
- var SBDisplayPref = getCookieSBDisplay();
- }
- }
- return parseInt(SBDisplayPref);
- }
- function SaveSBDisplay(prefValue) {
- if(typeof(Storage) !== "undefined") {
- localStorage.setItem("PrefDisplaySB", prefValue);
- } else {
- setCookieSBDisplay(prefValue);
- }
- return true;
- }
- function SBDisplay() {
- if(document.getElementById("shoutbox_e").style.display == "none" && SBRuleNonButtonClick == 0) {return "lolnope";}
- if(!SBTimeRemaining && !timerOn) {
- SaveSBDisplay(1);
- }
- SBRuleNonButtonClick = 0;
- if (typeof(SBRuleResizing) != "undefined") { clearInterval(SBRuleResizing); }
- var SBDisplayPref = LoadSBDisplay();
- var SBRuleResizing = setInterval(function(){resizeSBRule();}, 250);
- if(SBDisplayPref){
- document.getElementById("AcceptButton").innerHTML = "Accept the rules";
- clearInterval(SBRuleResizing);
- document.getElementById("AcceptButton").parentNode.style.display = "none";
- } else if (!SBDisplayPref && SBTimeRemaining == 30){
- SBRuleTimer();
- document.getElementById("AcceptButton").parentNode.style.display = "table";
- } else if (!SBDisplayPref) {
- document.getElementById("AcceptButton").parentNode.style.display = "table";
- }
- }
- function ToggleSBRules() {
- var height = document.getElementById("shoutbox_e").clientHeight;
- document.getElementById("AcceptButton").parentNode.style.height = height;
- }
- function SBRuleTimer() {
- if(typeof(SBtimer) == "undefined" && timerOn == 0 && SBTimeRemaining > 0) {
- SBTimeRemaining = 30;
- var SBtimer = setTimeout(function(){SBRuleTimer()}, 1000);
- timerOn = 1;
- } else if(SBTimeRemaining > 0 && timerOn == 1) {
- SBTimeRemaining--;
- document.getElementById("AcceptButton").innerHTML = "Accept the rules ("+ SBTimeRemaining +")";
- SBtimer = setTimeout(function(){SBRuleTimer()}, 1000);
- timerOn = 1;
- } else if (SBTimeRemaining < 0) {
- SBTimeRemaining = 30;
- SBtimer = setTimeout(function(){SBRuleTimer()}, 1000);
- timerOn = 1;
- }
- if(SBTimeRemaining == 0 && timerOn == 1) {
- document.getElementById("AcceptButton").innerHTML = "Accept the rules";
- timerOn = 0;
- }
- return false;
- }
- function resizeSBRule() {
- var SBRuleBox = document.getElementById("AcceptButton").parentNode;
- SBRuleBox.style.width = document.getElementById("shoutbox_e").clientWidth + "px";
- SBRuleBox.style.height = document.getElementById("shoutbox_e").clientHeight + "px";
- var ShoutingBox = document.getElementById("shoutbox_e").getElementsByTagName("tr");
- var ShoutingBoxtoComp = ShoutingBox[1].getElementsByTagName("td")[0]
- var excessHeight = 2*(parseInt(window.getComputedStyle(ShoutingBoxtoComp, null).getPropertyValue("padding-top")) + parseInt(window.getComputedStyle(ShoutingBoxtoComp, null).getPropertyValue("border-top-width")) + parseInt(window.getComputedStyle(SBRuleBox, null).getPropertyValue("padding-top")) + parseInt(window.getComputedStyle(SBRuleBox, null).getPropertyValue("border-top-width")));
- var HToGo = SBRuleBox.clientHeight - ShoutingBox[0].clientHeight - excessHeight + "px";
- if(isIE11()){HToGo = parseInt(HToGo) - 1 + "px";}
- document.getElementById("shoutbox_data").style.height = HToGo;
- }
- function showSBRules() {
- if(LoadSBDisplay()) {
- SaveSBDisplay(0);
- SBTimeRemaining = 0;
- timerOn = 1;
- SBDisplay();
- timerOn = 0;
- }
- }
- var FullShoutbox = document.getElementById("shoutbox_e");
- var coverDiv = document.createElement("div");
- SHeight = document.getElementById("shoutbox_e").clientHeight + "px";
- SWidth = document.getElementById("shoutbox_e").clientWidth + "px";
- /*
- ##########################
- RULES
- ##########################
- */
- FullShoutbox.parentNode.insertBefore(coverDiv, FullShoutbox);
- coverDiv.outerHTML = '<div style="color: #777; position: absolute; z-index: 10; height: '+SHeight+'; width: '+SWidth+'; background: #181818" class="trow1"><div style="margin-bottom: 20px; display: table; margin-left: auto; margin-right: auto; margin-top: 10px">'+
- 'This is an english chat. speak english<br/>'+
- 'This is not for WeepCraft help. use the help section<br/>'+
- 'This is not for advertisement. if you have a grief request post a thread or add it to the server list<br/>'+
- 'No Spam \/ Flame \/ Racism<br/>'+
- 'No shouting gross pictures or websites nor screamer sites.<br/>'+
- 'This is a chat for users to interact <strong>not</strong> for support questions<br/>'+
- 'Breaking any of the above may result in a ban from the shoutbox without warning.<br/>'+
- '</div>'+
- '<a class="button" id="AcceptButton" onclick="SBDisplay();" style="display:table; margin: 0 auto; margin-bottom: 10px">Accept the rules (30)</a></div>';
- var SBTimeRemaining = 30;
- var timerOn = 0;
- var SBContractSize = document.getElementById("shoutbox_data").style.height;
- var SBRuleNonButtonClick = 0;
- document.getElementById("datToggle").setAttribute("onclick", "toggleSB(); ToggleSBRules();");
- document.getElementById("shoutbox_img").setAttribute("onclick", "toggleSBDisplay();");
- document.getElementById("shout_data").setAttribute("autocomplete", "off");
- SBDisplay();
- //I really hope fly-senpai will notice me
Advertisement
Add Comment
Please, Sign In to add comment