User:MateyY/ModuleStyle.js

/* The following script was created by MateyY. * Version: 2.0 beta * For skins: oasis * JavaScript library used: jQuery * Function: Fast style for modules. * Build for use on: all wikis * Do NOT use except with permission. * Do NOT copy the code; import it! * Thank you! */

$(document).ready(function {     if (skin == "oasis") {          if (gradient == true) {               if (startColor && endColor) {		        if (important == true || importantGradient == true) {			          var gradientCSS = {		                       /* For browsers that do not support gradient */		                       "backgroundColor" : startColor,		                       /* Gradients for different browsers */		                       /* Webkit browsers */		                       "backgroundImage" : "-webkit-linear-gradient(top, " + startColor + ", " + endColor + " !important)",		                       /* Mozilla Firefox (for versions 3.6 and up) */		                       "background" : "-moz-linear-gradient(top, "+ startColor + ", " + endColor + " !important)",		                       /* Internet Explorer */		                       "filter" : "progid:DXImageTransform.Microsoft.gradient(startColorstr= '" + startColor + "', endColorstr='" + endColor + "' !important)", /* Other browsers */ "background-image" : "linear-gradient(" + startColor + ", " + endColor + " !important)", /* Opera */ "background-image" : "-o-linear-gradient(" + startColor + ", " + endColor + " !important)", /* More */ "background-image" : "-ms-linear-gradient(" + startColor + ", " + endColor + " !important)" }		       } else { var gradientCSS = { /* For browsers that do not support gradient */ "backgroundColor" : startColor, /* Gradients for different browsers */ /* Webkit browsers */ "backgroundImage" : "-webkit-linear-gradient(top, " + startColor + ", " + endColor + ")", /* Mozilla Firefox (for versions 3.6 and up) */ "background" : "-moz-linear-gradient(top, "+ startColor + ", " + endColor + ")", /* Internet Explorer */ "filter" : "progid:DXImageTransform.Microsoft.gradient(startColorstr= '" + startColor + "', endColorstr='" + endColor + "')", /* Other browsers */ "background-image" : "linear-gradient(" + startColor + ", " + endColor + ")", /* Opera */ "background-image" : "-o-linear-gradient(" + startColor + ", " + endColor + ")", /* More */ "background-image" : "-ms-linear-gradient(" + startColor + ", " + endColor + ")" }		       }                    if (editPages == true || editPagesGradient == true) $(".module, #EditPageRail").css(gradientCSS); else $(".module").css(gradientCSS); }         }          if (borderRadiusPresent == true) { if (borderRadiusLength && borderRadiusLength) { if (important == true || importantBorderRadius == true) $(".module").css("borderRadius", borderRadiusLength + " !important"); else $(".module").css("borderRadius", borderRadiusLength); if (editPages == true || editPagesBorderRadius == true && importantBorderRadius == true || important == true) $("#EditPageRail").css("borderRadius", borderRadiusLength + " !important"); else if (editPages == true || editPagesBorderRadius == true) $("#EditPageRail").css("borderRadius", borderRadiusLength); } else if (!borderRadiusLength) { if (borderRadiusBottomLeft && borderRadiusBottomRight && borderRadiusTopLeft && borderRadiusTopRight && important == true || importantBorderRadius == true) { var borderRadiusCSSSeparate = { "border-top-left-radius" : borderRadiusTopLeft + " !important", "border-top-right-radius" : borderRadiusTopRight + " !important", "border-bottom-right-radius" : borderRadiusBottomRight + " !important", "border-bottom-left-radius" : borerRadiusBottomLeft + " !important", /* Mozilla Firefox */ "-moz-border-radius-topleft" : borderRadiusTopLeft + " !important", "-moz-border-radius-topright" : borderRadiusTopRight + " !important", "-moz-border-radius-bottomright" : borderRadiusBottomRight + " !important", "-moz-border-radius-bottomleft" : borerRadiusBottomLeft + " !important" }                   } else if (borderRadiusBottomLeft && borderRadiusBottomRight && borderRadiusTopLeft && borderRadiusTopRight) { var borderRadiusCSSSeparate = { "border-top-left-radius" : borderRadiusTopLeft, "border-top-right-radius" : borderRadiusTopRight, "border-bottom-right-radius" : borderRadiusBottomRight, "border-bottom-left-radius" : borerRadiusBottomLeft, /* Mozilla Firefox */ "-moz-border-radius-topleft" : borderRadiusTopLeft, "-moz-border-radius-topright" : borderRadiusTopRight, "-moz-border-radius-bottomright" : borderRadiusBottomRight, "-moz-border-radius-bottomleft" : borerRadiusBottomLeft }                        if (editPages == true || editPagesBorderRadius == true) $(".module, #EditPageRail").css(borderRadiusCSSSeparate); else $(".module").css(borderRadiusCSSSeparate); }              }          }     } });

/*  !! DOCUMENTATION !! The following script works with elements classed as module. To import it, write: importScriptPage('User:MateyY/ModuleStyle.js', 'c'); To use gradient, add this before the import: var gradient = true; Then you have to add the starting and ending color; otherwise the template will not work: var startColor = STARTING COLOR GOES HERE; var endColor  = ENDING COLOR GOES HERE; Replace the words in caps with color. To use the border radius option, add: var borderRadiusPresent = true; Then add: var borderRadiusLength = "#px"; This will set the radius for all borders. If you want to add them separately, add this: var borderRadiusTopLeft = "#px"; var borderRadiusTopRight = "#px"; var borderRadiusBottomLeft = "#px"; var borderRadiusBottomRight = "#px"; You can still define tilts, etc. So you can also have "var borderRadiusTopLeft = '#px #px';", and so on. Just insure that if you are defining the borders separately you give all of them a value! Make sure you define all four variables, even if that means you have to give one the value of 0px (it's safer to define a unit of measurement, because 0 is the number equal to the value of null)! I also recommend you just write "var borderRadiusLength = '#px #px #px #px';" for different values. Your final code should look something like this: var gradient = true; var startColor = "STARTING COLOR GOES HERE"; var endColor  = "ENDING COLOR GOES HERE"; var borderRadiusPresent = true; var borderRadiusLength = "#px"; importScriptPage('User:MateyY/ModuleStyle.js', 'c'); Or... var gradient = true; var startColor = "STARTING COLOR GOES HERE"; var endColor  = "ENDING COLOR GOES HERE"; var borderRadiusPresent = true; var borderRadiusTopLeft = "#px"; var borderRadiusTopRight = "#px"; var borderRadiusBottomLeft = "#px"; var borderRadiusBottomRight = "#px"; importScriptPage('User:MateyY/ModuleStyle.js', 'c'); If you do not want a feature enabled, add a variable that either says nothing but true in any way shape or form (do not give it the value of true, "true", 1, or "1"), or just don't define it. However, I suggest the first option, because ECMA5's strict mode may interpret that as an error.