Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // ==UserScript==
- // @name My e-shuushuu Script
- // @description A brief description of your script
- // @author Your Name
- // @include http://e-shuushuu.net*
- // @version 1.0
- // ==/UserScript==
- var anim = {};
- $(document).ready(function () {
- dButtonGradientInactive = "-webkit-gradient( " + '\n' +
- " linear, " + '\n' +
- " left bottom, " + '\n' +
- " left top, " + '\n' +
- " color-stop(0.45, #444), " + '\n' +
- " color-stop(0.95, #666), " + '\n' +
- " color-stop(1, #999) " + '\n' +
- " )";
- dButtonGradientClick = "-webkit-gradient( " + '\n' +
- " linear, " + '\n' +
- " left bottom, " + '\n' +
- " left top, " + '\n' +
- " color-stop(0, #222), " + '\n' +
- " color-stop(0.05, #333), " + '\n' +
- " color-stop(0.45, #333), " + '\n' +
- " color-stop(0.95, #555), " + '\n' +
- " color-stop(1, #111) " + '\n' +
- " )";
- dButtonGradientActive = "-webkit-gradient( " + '\n' +
- " linear, " + '\n' +
- " left bottom, " + '\n' +
- " left top, " + '\n' +
- " color-stop(0, #fd0), " + '\n' +
- " color-stop(0.05, #f90), " + '\n' +
- " color-stop(0.95, #f70), " + '\n' +
- " color-stop(1, #a30) " + '\n' +
- " )";
- dButtonGradientHover = "-webkit-gradient( " + '\n' +
- " linear, " + '\n' +
- " left bottom, " + '\n' +
- " left top, " + '\n' +
- " color-stop(0.45, #555), " + '\n' +
- " color-stop(0.95, #777), " + '\n' +
- " color-stop(1, #999) " + '\n' +
- " )";
- var rad = 4;
- // Style rules. note that everything is prefixed with
- // a "d" for dynamic. This is to avoid conflicts.
- var dStyleSheet = document.createElement("style");
- dStyleSheet.setAttribute("type", "text/css");
- var dTxt =
- "#dToggle { " + '\n' +
- " position : fixed; " + '\n' +
- " right : 2px; " + '\n' +
- " width : 163px; " + '\n' +
- " top : 0px; " + '\n' +
- " font-family : Arial,Helvetica,sans-serif; " + '\n' +
- " font-size: 100%; " + '\n' +
- " line-height: 12px; " + '\n' +
- "} " + '\n' +
- "#dBackground { " + '\n' +
- " background-color : #000; " + '\n' +
- " border : 1px solid black; " + '\n' +
- " opacity : 0.8; " + '\n' +
- " position : absolute; " + '\n' +
- " width : 100%; " + '\n' +
- " height : 100%; " + '\n' +
- "} " + '\n' +
- "#dToggle label { " + '\n' +
- " display : inline-block; " + '\n' +
- " background-image : " + dButtonGradientInactive + ";" + '\n' +
- " color : #fff; " + '\n' +
- " border : 1px outset #444; " + '\n' +
- " padding : 10px; " + '\n' +
- " margin : 0px; " + '\n' +
- " width : 80px; " + '\n' +
- " border-radius : " + rad + "px 0px 0px " + rad + "px; " + '\n' +
- " cursor : pointer; " + '\n' +
- "} " + '\n' +
- "#dToggle .dItem { " + '\n' +
- " position : relative; " + '\n' +
- " z-index:1; " + '\n' +
- " padding : 0px 10px 0px 10px; " + '\n' +
- "} " + '\n' +
- "#dToggle input { " + '\n' +
- " display : inline-block; " + '\n' +
- " background-image : " + dButtonGradientInactive + ";" + '\n' +
- " color : #fff; " + '\n' +
- " border : 1px outset #444; " + '\n' +
- " border-left-color : #333; " + '\n' +
- " width : 42px; " + '\n' +
- " text-align : left; " + '\n' +
- " padding : 8px; " + '\n' +
- " margin : 0px 0px 0px -5px; " + '\n' +
- " border-radius : 0px " + rad + "px " + rad + "px 0px; " + '\n' +
- " float : right; " + '\n' +
- "} " + '\n' +
- "";
- dStyleSheet.appendChild(document.createTextNode(dTxt));
- $("head").append(dStyleSheet);
- function ToggleName(id) {
- if (CheckToggle(id)) {
- $(id).attr("value", "Off");
- $(id).css("background-image", dButtonGradientInactive);
- $(id).css("border-style", "outset");
- } else {
- $(id).attr("value", "On");
- $(id).css("background-image", dButtonGradientActive);
- $(id).css("border-style", "inset");
- }
- }
- function CheckToggle(id) {
- var text = $(id).attr("value");
- if (text == "On") {
- return true;
- } else {
- return false;
- }
- }
- $("body").append(
- '<div id="dToggle"> ' +
- ' <div id="dBackground"></div> ' +
- ' <div class="dItem"> ' +
- ' <label name="#toggleComments" handles=".post_block"> ' +
- ' Comments: ' +
- ' </label> ' +
- ' <input id="toggleComments" handles=".post_block" type="button" value="Off" /> ' +
- ' </div> ' +
- ' <div class="dItem"> ' +
- ' <label name="#toggleDescriptions" handles="#banner_image"> ' +
- ' Descriptions Descriptions Descriptions Descriptions Descriptions Descriptions Descriptions: ' +
- ' </label> ' +
- ' <input id="toggleDescriptions" handles="#banner_image" type="button" value="Off" /> ' +
- ' </div> ' +
- '</div> '
- )
- $("#dToggle label").click(function () {
- handles = $(this).attr("handles").split(",");
- for (i = 0; i < handles.length; i++) {
- $(handles[i]).slideToggle("slow");
- }
- ToggleName($(this).attr("name"))
- }).mousedown(function () {
- $(this).css("background-image", dButtonGradientClick);
- $(this).css("border-style", "inset");
- }).mouseup(function () {
- $(this).css("background-image", dButtonGradientHover);
- $(this).css("border-style", "outset");
- }).mouseenter(function () {
- $(this).css("background-image", dButtonGradientHover);
- }).mouseleave(function () {
- $(this).css("background-image", dButtonGradientInactive);
- $(this).css("border-style", "outset");
- });
- $(".dItem:first").css("padding", "10px 10px 0px 10px");
- $(".dItem:last").css("padding", "0px 10px 10px 10px");
- $(".dItem input").each(function(){
- $(this).height($(this).parent().height());
- });
- });
Advertisement
Add Comment
Please, Sign In to add comment