From feeb79096f3e11607596ba457fbac6b3be2c5353 Mon Sep 17 00:00:00 2001 From: Ian Caunce Date: Sun, 14 Dec 2014 18:09:34 +0000 Subject: [PATCH] Fixed incorrect indentation. Removed unused viewportUnits support property. --- js/rrssb.js | 17 ++++++++--------- js/rrssb.min.js | 4 ++-- 2 files changed, 10 insertions(+), 11 deletions(-) diff --git a/js/rrssb.js b/js/rrssb.js index 0f4acc8..8c0fcb4 100755 --- a/js/rrssb.js +++ b/js/rrssb.js @@ -21,8 +21,7 @@ 'use strict'; var support = { - calc : false, - viewportUnits : false + calc : false }; /* @@ -93,11 +92,11 @@ var buttons = jQuery('li', self); var smallButtons = buttons.filter('.small'); - var totalBtnSze = 0; - var totalTxtSze = 0; - var upCandidate = smallButtons.first(); - var nextBackUp = parseFloat(upCandidate.attr('data-size')) + 55; - var smallBtnCount = smallButtons.length; + var totalBtnSze = 0; + var totalTxtSze = 0; + var upCandidate = smallButtons.first(); + var nextBackUp = parseFloat(upCandidate.attr('data-size')) + 55; + var smallBtnCount = smallButtons.length; if (smallBtnCount === buttons.length) { var btnCalc = smallBtnCount * 42; @@ -137,7 +136,7 @@ var self = jQuery(this); var buttons = jQuery('li', self); var elems = buttons.nextAll(); - var count = elems.length; + var count = elems.length; // get buttons in reverse order and loop through each jQuery(buttons.get().reverse()).each(function(index, count) { @@ -170,7 +169,7 @@ jQuery('.rrssb-buttons').each(function(index) { var self = jQuery(this); var regButtonCount; - var regPercent; + var regPercent; var pixelsOff; var magicWidth; var smallBtnFraction; diff --git a/js/rrssb.min.js b/js/rrssb.min.js index 072b226..2072635 100644 --- a/js/rrssb.min.js +++ b/js/rrssb.min.js @@ -1,4 +1,4 @@ -/*! +/* Ridiculously Responsive Social Sharing Buttons Team: @dbox, @joshuatuscan Site: http://www.kurtnoble.com/labs/rrssb @@ -15,4 +15,4 @@ \ \:\ \ \:\ /__/:/ \ \:\ \ \:\ \__\/ \__\/ \__\/ -*/+function(window,jQuery,undefined){"use strict";var support={calc:false,viewportUnits:false};var detectCalcSupport=function(){var el=$("
");var calcProps=["calc","-webkit-calc","-moz-calc"];$("body").append(el);for(var i=0;i170&&jQuery("li.small",self).length<1){self.addClass("large-format")}else{self.removeClass("large-format")}if(containerWidth<200){self.removeClass("small-format").addClass("tiny-format")}else{self.removeClass("tiny-format")}})};var backUpFromSmall=function(){jQuery(".rrssb-buttons").each(function(index){var self=jQuery(this);var buttons=jQuery("li",self);var smallButtons=buttons.filter(".small");var totalBtnSze=0;var totalTxtSze=0;var upCandidate=smallButtons.first();var nextBackUp=parseFloat(upCandidate.attr("data-size"))+55;var smallBtnCount=smallButtons.length;if(smallBtnCount===buttons.length){var btnCalc=smallBtnCount*42;var containerWidth=self.width();if(btnCalc+nextBackUpbtnWidth){var btn2small=buttons.not(".small").last();jQuery(btn2small).addClass("small");sizeSmallBtns()}}if(!--count)backUpFromSmall()})});if(init===true){rrssbMagicLayout(sizeSmallBtns)}};var sizeSmallBtns=function(){jQuery(".rrssb-buttons").each(function(index){var self=jQuery(this);var regButtonCount;var regPercent;var pixelsOff;var magicWidth;var smallBtnFraction;var buttons=jQuery("li",self);var smallButtons=buttons.filter(".small");var smallBtnCount=smallButtons.length;if(smallBtnCount>0&&smallBtnCount!==buttons.length){self.removeClass("small-format");smallButtons.css("width","42px");pixelsOff=smallBtnCount*42;regButtonCount=buttons.not(".small").length;regPercent=100/regButtonCount;smallBtnFraction=pixelsOff/regButtonCount;if(support.calc===false){magicWidth=self.innerWidth()/regButtonCount-smallBtnFraction;magicWidth=Math.floor(magicWidth*1e3)/1e3;magicWidth+="px"}else{magicWidth=support.calc+"("+regPercent+"% - "+smallBtnFraction+"px)"}buttons.not(".small").css("width",magicWidth)}else if(smallBtnCount===buttons.length){self.addClass("small-format");setPercentBtns()}else{self.removeClass("small-format");setPercentBtns()}});makeExtremityBtns()};var rrssbInit=function(){jQuery(".rrssb-buttons").each(function(index){jQuery(this).addClass("rrssb-"+(index+1))});detectCalcSupport();setPercentBtns();jQuery(".rrssb-buttons li .rrssb-text").each(function(index){var buttonTxt=jQuery(this);var txtWdth=buttonTxt.width();buttonTxt.closest("li").attr("data-size",txtWdth)});checkSize(true)};var rrssbMagicLayout=function(callback){jQuery(".rrssb-buttons li.small").removeClass("small");checkSize();callback()};var popupCenter=function(url,title,w,h){var dualScreenLeft=window.screenLeft!==undefined?window.screenLeft:screen.left;var dualScreenTop=window.screenTop!==undefined?window.screenTop:screen.top;var width=window.innerWidth?window.innerWidth:document.documentElement.clientWidth?document.documentElement.clientWidth:screen.width;var height=window.innerHeight?window.innerHeight:document.documentElement.clientHeight?document.documentElement.clientHeight:screen.height;var left=width/2-w/2+dualScreenLeft;var top=height/3-h/3+dualScreenTop;var newWindow=window.open(url,title,"scrollbars=yes, width="+w+", height="+h+", top="+top+", left="+left);if(window.focus){newWindow.focus()}};var waitForFinalEvent=function(){var timers={};return function(callback,ms,uniqueId){if(!uniqueId){uniqueId="Don't call this twice without a uniqueId"}if(timers[uniqueId]){clearTimeout(timers[uniqueId])}timers[uniqueId]=setTimeout(callback,ms)}}();jQuery(document).ready(function(){jQuery(".rrssb-buttons a.popup").on("click",function(e){var self=jQuery(this);popupCenter(self.attr("href"),self.find(".rrssb-text").html(),580,470);e.preventDefault()});jQuery(window).resize(function(){rrssbMagicLayout(sizeSmallBtns);waitForFinalEvent(function(){rrssbMagicLayout(sizeSmallBtns)},200,"finished resizing")});rrssbInit()});window.rrssbInit=rrssbInit}(window,jQuery); \ No newline at end of file +*/+function(window,jQuery,undefined){"use strict";var support={calc:false};var detectCalcSupport=function(){var el=$("
");var calcProps=["calc","-webkit-calc","-moz-calc"];$("body").append(el);for(var i=0;i170&&jQuery("li.small",self).length<1){self.addClass("large-format")}else{self.removeClass("large-format")}if(containerWidth<200){self.removeClass("small-format").addClass("tiny-format")}else{self.removeClass("tiny-format")}})};var backUpFromSmall=function(){jQuery(".rrssb-buttons").each(function(index){var self=jQuery(this);var buttons=jQuery("li",self);var smallButtons=buttons.filter(".small");var totalBtnSze=0;var totalTxtSze=0;var upCandidate=smallButtons.first();var nextBackUp=parseFloat(upCandidate.attr("data-size"))+55;var smallBtnCount=smallButtons.length;if(smallBtnCount===buttons.length){var btnCalc=smallBtnCount*42;var containerWidth=self.width();if(btnCalc+nextBackUpbtnWidth){var btn2small=buttons.not(".small").last();jQuery(btn2small).addClass("small");sizeSmallBtns()}}if(!--count)backUpFromSmall()})});if(init===true){rrssbMagicLayout(sizeSmallBtns)}};var sizeSmallBtns=function(){jQuery(".rrssb-buttons").each(function(index){var self=jQuery(this);var regButtonCount;var regPercent;var pixelsOff;var magicWidth;var smallBtnFraction;var buttons=jQuery("li",self);var smallButtons=buttons.filter(".small");var smallBtnCount=smallButtons.length;if(smallBtnCount>0&&smallBtnCount!==buttons.length){self.removeClass("small-format");smallButtons.css("width","42px");pixelsOff=smallBtnCount*42;regButtonCount=buttons.not(".small").length;regPercent=100/regButtonCount;smallBtnFraction=pixelsOff/regButtonCount;if(support.calc===false){magicWidth=self.innerWidth()/regButtonCount-smallBtnFraction;magicWidth=Math.floor(magicWidth*1e3)/1e3;magicWidth+="px"}else{magicWidth=support.calc+"("+regPercent+"% - "+smallBtnFraction+"px)"}buttons.not(".small").css("width",magicWidth)}else if(smallBtnCount===buttons.length){self.addClass("small-format");setPercentBtns()}else{self.removeClass("small-format");setPercentBtns()}});makeExtremityBtns()};var rrssbInit=function(){jQuery(".rrssb-buttons").each(function(index){jQuery(this).addClass("rrssb-"+(index+1))});detectCalcSupport();setPercentBtns();jQuery(".rrssb-buttons li .rrssb-text").each(function(index){var buttonTxt=jQuery(this);var txtWdth=buttonTxt.width();buttonTxt.closest("li").attr("data-size",txtWdth)});checkSize(true)};var rrssbMagicLayout=function(callback){jQuery(".rrssb-buttons li.small").removeClass("small");checkSize();callback()};var popupCenter=function(url,title,w,h){var dualScreenLeft=window.screenLeft!==undefined?window.screenLeft:screen.left;var dualScreenTop=window.screenTop!==undefined?window.screenTop:screen.top;var width=window.innerWidth?window.innerWidth:document.documentElement.clientWidth?document.documentElement.clientWidth:screen.width;var height=window.innerHeight?window.innerHeight:document.documentElement.clientHeight?document.documentElement.clientHeight:screen.height;var left=width/2-w/2+dualScreenLeft;var top=height/3-h/3+dualScreenTop;var newWindow=window.open(url,title,"scrollbars=yes, width="+w+", height="+h+", top="+top+", left="+left);if(window.focus){newWindow.focus()}};var waitForFinalEvent=function(){var timers={};return function(callback,ms,uniqueId){if(!uniqueId){uniqueId="Don't call this twice without a uniqueId"}if(timers[uniqueId]){clearTimeout(timers[uniqueId])}timers[uniqueId]=setTimeout(callback,ms)}}();jQuery(document).ready(function(){jQuery(".rrssb-buttons a.popup").on("click",function(e){var self=jQuery(this);popupCenter(self.attr("href"),self.find(".rrssb-text").html(),580,470);e.preventDefault()});jQuery(window).resize(function(){rrssbMagicLayout(sizeSmallBtns);waitForFinalEvent(function(){rrssbMagicLayout(sizeSmallBtns)},200,"finished resizing")});rrssbInit()});window.rrssbInit=rrssbInit}(window,jQuery); \ No newline at end of file