From 1164925b73b66740e0110cd5b5c6edd81c31bb95 Mon Sep 17 00:00:00 2001 From: Benjamin Date: Sat, 14 Jan 2012 19:08:01 -0500 Subject: [PATCH] Cleanup - Swapped tabs for spaces --- jquery.swapstyle.js | 21 ++++--- jquery.swapstyle.min.js | 2 +- tests/index.html | 118 ++++++++++++++++++++-------------------- tests/styles/four.css | 52 +++++++++--------- tests/styles/one.css | 28 +++++----- tests/styles/three.css | 52 +++++++++--------- tests/styles/two.css | 28 +++++----- 7 files changed, 152 insertions(+), 149 deletions(-) diff --git a/jquery.swapstyle.js b/jquery.swapstyle.js index f9ad43d..bf964d7 100644 --- a/jquery.swapstyle.js +++ b/jquery.swapstyle.js @@ -13,9 +13,9 @@ thisSheet, // Cache each sheet as we loop through thisNode, // Node for link tags href, // Cache the href - cssRules, // So we can store where the browser stores import rules + cssRules, // So we can have where the browser keeps import rules rule; // Cache the rule - + // Loop through all the stylesheets for ( s = 0; s < document.styleSheets.length; s++ ) { // The current stylesheet @@ -24,7 +24,7 @@ // If the href property isn't null, we should check the rule. if ( thisSheet.href !== null && typeof thisSheet.href !== "undefined" ) { - if ( thisSheet.href.indexOf( original ) !== -1 ) { + if ( thisSheet.href.indexOf( original ) !== -1 ) { // Modify the link in question thisNode = thisSheet.ownerNode; @@ -35,7 +35,7 @@ href = thisNode.href; thisNode.href = href.replace( original, replacement ); - + // We've already replaced the stylesheet, so we // shouldn't haveto check any of it's rules. continue; @@ -56,7 +56,7 @@ // The current rule rule = cssRules[ r ]; - /* + /* * If the rule has an href, it's an @import! We * should check the href. I tried using 'instanceof,' * but Opera had no idea how to handle that @@ -65,7 +65,7 @@ rule.href.indexOf(original) != -1 ) { */ if ( rule.href !== null && - typeof rule.href !== "undefined" ) { + typeof rule.href !== "undefined" ) { if ( rule.href.indexOf( original ) !== -1 ) { // Insert the new rule at the end if ( thisSheet.insertRule ) { @@ -75,7 +75,10 @@ ); } else { // IE - thisSheet.addImport( replacement, cssRules.length ); + thisSheet.addImport( + replacement, + cssRules.length + ); } // Delete the old one to get rid of clutter @@ -85,10 +88,10 @@ // IE thisSheet.removeImport( r ); } - } // IF :rule.href.indexOf( original ) !== -1 + } // IF: rule.href.indexOf( original ) !== -1 } // IF: rule.href !== null && typeof rule.href !== "undefined" } // FOR: r = 0; r < cssRules.length; r++ } // IF: typeof cssRules !== "undefined" } // FOR: s = 0; s < document.styleSheets.length; s++ }; -} )( jQuery ); \ No newline at end of file +} )( jQuery ); diff --git a/jquery.swapstyle.min.js b/jquery.swapstyle.min.js index 8a38664..539e129 100644 --- a/jquery.swapstyle.min.js +++ b/jquery.swapstyle.min.js @@ -3,4 +3,4 @@ * Author: Benjamin Leffler * Date: 09/14/11 */ -(function(a){"use strict";a.swapstyle=function(a,b){var c,d,e,f,g,h,i;for(c=0;c - - jQuery.SwapStyle() - - - - - - -

jQuery.SwapStyle()

-

Author: Benjamin Leffler

-
- Styled by link tag - -
- - -
- - - \ No newline at end of file + + jQuery.SwapStyle() + + + + + + +

jQuery.SwapStyle()

+

Author: Benjamin Leffler

+
+ Styled by link tag + +
+ + +
+ + + diff --git a/tests/styles/four.css b/tests/styles/four.css index 8ac0ef8..f5aa4a2 100644 --- a/tests/styles/four.css +++ b/tests/styles/four.css @@ -1,33 +1,33 @@ .theForm { - border: 3px solid gray; - -webkit-border-radius: 8px; - -moz-border-radius: 8px; - -o-border-radius: 8px; - -ms-border-radius: 8px; - border-radius: 8px; - background-color: #888; - position: absolute; - bottom: 25px; - left: 25px; - color: white; + border: 3px solid gray; + -webkit-border-radius: 8px; + -moz-border-radius: 8px; + -o-border-radius: 8px; + -ms-border-radius: 8px; + border-radius: 8px; + background-color: #888; + position: absolute; + bottom: 25px; + left: 25px; + color: white; } .theForm > legend { - border: 3px solid gray; - -webkit-border-radius: 8px; - -moz-border-radius: 8px; - -o-border-radius: 8px; - -ms-border-radius: 8px; - border-radius: 8px; - -webkit-box-shadow: -2px 2px 1px black; - -mozilla-box-shadow: -2px 2px 1px black; - -o-box-shadow: -2px 2px 1px black; - -ms-box-shadow: -2px 2px 1px black; - box-shadow: -2px 2px 1px black; - background-color: #888; - color: white; + border: 3px solid gray; + -webkit-border-radius: 8px; + -moz-border-radius: 8px; + -o-border-radius: 8px; + -ms-border-radius: 8px; + border-radius: 8px; + -webkit-box-shadow: -2px 2px 1px black; + -mozilla-box-shadow: -2px 2px 1px black; + -o-box-shadow: -2px 2px 1px black; + -ms-box-shadow: -2px 2px 1px black; + box-shadow: -2px 2px 1px black; + background-color: #888; + color: white; } .theForm > label { - font-size: .8em; -} \ No newline at end of file + font-size: .8em; +} diff --git a/tests/styles/one.css b/tests/styles/one.css index 503ae3e..f2e0713 100644 --- a/tests/styles/one.css +++ b/tests/styles/one.css @@ -1,27 +1,27 @@ body { - background-color: #506077; - color: black; - margin: 75px; - font-family: 'Open Sans', sans-serif; + background-color: #506077; + color: black; + margin: 75px; + font-family: 'Open Sans', sans-serif; } h1 { - color: gray; - font-size: 2em; - margin: 0; + color: gray; + font-size: 2em; + margin: 0; } h1 > a { - color: gray; + color: gray; } h2 { - margin: 0 0 0 25px; - color: #203044; - font-size: 1.5em; + margin: 0 0 0 25px; + color: #203044; + font-size: 1.5em; } h2 > a { - text-decoration: none; - color: #304055; -} \ No newline at end of file + text-decoration: none; + color: #304055; +} diff --git a/tests/styles/three.css b/tests/styles/three.css index 30e7c81..7a01872 100644 --- a/tests/styles/three.css +++ b/tests/styles/three.css @@ -1,33 +1,33 @@ .theForm { - border: 2px solid white; - -webkit-border-radius: 5px; - -moz-border-radius: 5px; - -o-border-radius: 5px; - -ms-border-radius: 5px; - border-radius: 5px; - background-color: #DDD; - position: absolute; - bottom: 25px; - right: 25px; - color: black; + border: 2px solid white; + -webkit-border-radius: 5px; + -moz-border-radius: 5px; + -o-border-radius: 5px; + -ms-border-radius: 5px; + border-radius: 5px; + background-color: #DDD; + position: absolute; + bottom: 25px; + right: 25px; + color: black; } .theForm > legend { - border: 2px solid white; - -webkit-border-radius: 5px; - -moz-border-radius: 5px; - -o-border-radius: 5px; - -ms-border-radius: 5px; - border-radius: 5px; - -webkit-box-shadow: 2px 2px 1px black; - -mozilla-box-shadow: 2px 2px 1px black; - -o-box-shadow: 2px 2px 1px black; - -ms-box-shadow: 2px 2px 1px black; - box-shadow: 2px 2px 1px black; - background-color: #DDD; - color: black; + border: 2px solid white; + -webkit-border-radius: 5px; + -moz-border-radius: 5px; + -o-border-radius: 5px; + -ms-border-radius: 5px; + border-radius: 5px; + -webkit-box-shadow: 2px 2px 1px black; + -mozilla-box-shadow: 2px 2px 1px black; + -o-box-shadow: 2px 2px 1px black; + -ms-box-shadow: 2px 2px 1px black; + box-shadow: 2px 2px 1px black; + background-color: #DDD; + color: black; } .theForm > label { - font-size: 1em; -} \ No newline at end of file + font-size: 1em; +} diff --git a/tests/styles/two.css b/tests/styles/two.css index 0c71236..77ea239 100644 --- a/tests/styles/two.css +++ b/tests/styles/two.css @@ -1,27 +1,27 @@ body { - background-color: silver; - color: white; - margin: 75px; - font-family: 'Oswald', sans-serif; + background-color: silver; + color: white; + margin: 75px; + font-family: 'Oswald', sans-serif; } h1 { - color: blue; - font-size: 3em; - margin: 0 0 0 50px; + color: blue; + font-size: 3em; + margin: 0 0 0 50px; } h1 > a { - color: blue; + color: blue; } h2 { - margin: 0 0 0 30px; - color: #203044; - font-size: 2em; + margin: 0 0 0 30px; + color: #203044; + font-size: 2em; } h2 > a { - text-decoration: none; - color: #304055; -} \ No newline at end of file + text-decoration: none; + color: #304055; +}