iasd-bootstrap-sass 1.7.0 → 1.7.10
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/lib/iasd-bootstrap-sass/version.rb +1 -1
- data/stylesheets/_iasd-rpsp.scss +411 -10
- data/stylesheets/_iasd-type.scss +27 -1
- data/stylesheets/_iasd-widgets.scss +18 -3
- data/templates/project/fonts/Lora-Bold.ttf +0 -0
- data/templates/project/fonts/Lora-BoldItalic.ttf +0 -0
- data/templates/project/fonts/Lora-Italic.ttf +0 -0
- data/templates/project/fonts/Lora-Regular.ttf +0 -0
- data/templates/project/img/favicons/apple-touch-icon-114x114.png +0 -0
- data/templates/project/img/favicons/apple-touch-icon-120x120.png +0 -0
- data/templates/project/img/favicons/apple-touch-icon-144x144.png +0 -0
- data/templates/project/img/favicons/apple-touch-icon-152x152.png +0 -0
- data/templates/project/img/favicons/apple-touch-icon-57x57.png +0 -0
- data/templates/project/img/favicons/apple-touch-icon-60x60.png +0 -0
- data/templates/project/img/favicons/apple-touch-icon-72x72.png +0 -0
- data/templates/project/img/favicons/apple-touch-icon-76x76.png +0 -0
- data/templates/project/img/favicons/apple-touch-icon-precomposed.png +0 -0
- data/templates/project/img/favicons/apple-touch-icon.png +0 -0
- data/templates/project/img/favicons/favicon-160x160.png +0 -0
- data/templates/project/img/favicons/favicon-16x16.png +0 -0
- data/templates/project/img/favicons/favicon-196x196.png +0 -0
- data/templates/project/img/favicons/favicon-32x32.png +0 -0
- data/templates/project/img/favicons/favicon-96x96.png +0 -0
- data/templates/project/img/favicons/favicon.ico +0 -0
- data/templates/project/img/favicons/mstile-144x144.png +0 -0
- data/templates/project/img/favicons/mstile-150x150.png +0 -0
- data/templates/project/img/favicons/mstile-310x150.png +0 -0
- data/templates/project/img/favicons/mstile-310x310.png +0 -0
- data/templates/project/img/favicons/mstile-70x70.png +0 -0
- data/templates/project/img/headers/rpsp_header.png +0 -0
- data/templates/project/img/logos_es_ES/iasd_404.png +0 -0
- data/templates/project/img/logos_es_ES/iasd_404@2x.png +0 -0
- data/templates/project/img/logos_es_ES/iasd_dsa_home.png +0 -0
- data/templates/project/img/logos_es_ES/iasd_dsa_home@2x.png +0 -0
- data/templates/project/img/logos_es_ES/iasd_footer.png +0 -0
- data/templates/project/img/logos_es_ES/iasd_footer@2x.png +0 -0
- data/templates/project/img/logos_es_ES/iasd_header.png +0 -0
- data/templates/project/img/logos_es_ES/iasd_header@2x.png +0 -0
- data/templates/project/img/logos_es_ES/iasd_header_symbol.png +0 -0
- data/templates/project/img/logos_es_ES/iasd_header_symbol@2x.png +0 -0
- data/templates/project/img/logos_es_ES/iasd_header_symbol_small.png +0 -0
- data/templates/project/img/logos_es_ES/iasd_header_symbol_small@2x.png +0 -0
- data/templates/project/img/logos_es_ES/iasd_header_vertical.png +0 -0
- data/templates/project/img/logos_es_ES/iasd_header_vertical@2x.png +0 -0
- data/templates/project/img/logos_pt_BR/iasd_404.png +0 -0
- data/templates/project/img/logos_pt_BR/iasd_404@2x.png +0 -0
- data/templates/project/img/logos_pt_BR/iasd_dsa_home.png +0 -0
- data/templates/project/img/logos_pt_BR/iasd_dsa_home@2x.png +0 -0
- data/templates/project/img/logos_pt_BR/iasd_footer.png +0 -0
- data/templates/project/img/logos_pt_BR/iasd_footer@2x.png +0 -0
- data/templates/project/img/logos_pt_BR/iasd_header.png +0 -0
- data/templates/project/img/logos_pt_BR/iasd_header@2x.png +0 -0
- data/templates/project/img/logos_pt_BR/iasd_header_symbol.png +0 -0
- data/templates/project/img/logos_pt_BR/iasd_header_symbol@2x.png +0 -0
- data/templates/project/img/logos_pt_BR/iasd_header_vertical.png +0 -0
- data/templates/project/img/logos_pt_BR/iasd_header_vertical@2x.png +0 -0
- data/templates/project/img/logos_pt_BR/rpsp_header_logo.png +0 -0
- data/templates/project/img/logos_pt_BR/rpsp_header_logo@2x.png +0 -0
- data/templates/project/lib/iasd-bootstrap.js +514 -3
- data/templates/project/lib/iasd-bootstrap.min.js +3 -5
- data/templates/project/lib/iasd_widgets.js +18 -0
- data/templates/project/lib/jquery.badonkatrunc.min.js +494 -1
- data/templates/project/lib/ltie9.js +2 -2
- data/templates/project/lib/ltie9.min.js +1 -1
- data/templates/project/manifest.rb +9 -0
- metadata +10 -3
data/stylesheets/_iasd-type.scss
CHANGED
@@ -22,4 +22,30 @@
|
|
22
22
|
"futurastd-light-webfont.woff",
|
23
23
|
"futurastd-light-webfont.ttf",
|
24
24
|
"futurastd-light-webfont.svg#futura_std_light"
|
25
|
-
), "futurastd-light-webfont.eot", 300, normal);
|
25
|
+
), "futurastd-light-webfont.eot", 300, normal);
|
26
|
+
|
27
|
+
|
28
|
+
@include font-face(
|
29
|
+
"Lora Std",
|
30
|
+
font-files(
|
31
|
+
"Lora-Regular.ttf"
|
32
|
+
));
|
33
|
+
|
34
|
+
@include font-face(
|
35
|
+
"Lora Bold",
|
36
|
+
font-files(
|
37
|
+
"Lora-Bold.ttf"
|
38
|
+
));
|
39
|
+
|
40
|
+
@include font-face(
|
41
|
+
"Lora Italic",
|
42
|
+
font-files(
|
43
|
+
"Lora-Italic.ttf"
|
44
|
+
));
|
45
|
+
|
46
|
+
|
47
|
+
@include font-face(
|
48
|
+
"Lora Bold Italic",
|
49
|
+
font-files(
|
50
|
+
"Lora-BoldItalic.ttf"
|
51
|
+
));
|
@@ -1139,6 +1139,20 @@ aside {
|
|
1139
1139
|
|
1140
1140
|
}
|
1141
1141
|
|
1142
|
+
@media (max-width: $screen-xs ){
|
1143
|
+
.col-sm-8,.col-md-8,.col-sm-12,.col-md-12{
|
1144
|
+
.iasd-widget-slider{
|
1145
|
+
&.col-sm-12, &.col-md-12{
|
1146
|
+
.owl-carousel {
|
1147
|
+
.slider-item{
|
1148
|
+
min-height: 245px !important;
|
1149
|
+
}
|
1150
|
+
}
|
1151
|
+
}
|
1152
|
+
}
|
1153
|
+
}
|
1154
|
+
}
|
1155
|
+
|
1142
1156
|
/* ***************** */
|
1143
1157
|
/* Posts Box Widget */
|
1144
1158
|
/* ***************** */
|
@@ -2512,7 +2526,7 @@ aside {
|
|
2512
2526
|
bottom: 0;
|
2513
2527
|
background: none;
|
2514
2528
|
padding: 0;
|
2515
|
-
margin:
|
2529
|
+
margin: 5px 30px 0 30px;
|
2516
2530
|
height: 17px;
|
2517
2531
|
width: 10px;
|
2518
2532
|
z-index: 10;
|
@@ -2685,7 +2699,7 @@ aside {
|
|
2685
2699
|
position: relative;
|
2686
2700
|
background: none;
|
2687
2701
|
padding: 0;
|
2688
|
-
margin:
|
2702
|
+
margin: 0px 30px 0 30px;
|
2689
2703
|
height: 17px;
|
2690
2704
|
width: 10px;
|
2691
2705
|
z-index: 10;
|
@@ -2890,7 +2904,7 @@ a.see-all-apps {
|
|
2890
2904
|
|
2891
2905
|
.iasd-apps-portal {
|
2892
2906
|
.iasd-widget{
|
2893
|
-
margin-bottom:
|
2907
|
+
margin-bottom: 25px; // Alterado de 50px para 40px WD
|
2894
2908
|
a{
|
2895
2909
|
color: white !important;
|
2896
2910
|
font-size: 12px;
|
@@ -3019,6 +3033,7 @@ a.see-all-apps {
|
|
3019
3033
|
|
3020
3034
|
.col-md-12-highlight{
|
3021
3035
|
margin-bottom: 40px;
|
3036
|
+
background-size: cover;
|
3022
3037
|
}
|
3023
3038
|
}
|
3024
3039
|
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
@@ -1,6 +1,6 @@
|
|
1
1
|
/*!
|
2
|
-
* IASD Bootstrap v1.7.
|
3
|
-
* Copyright 2014-
|
2
|
+
* IASD Bootstrap v1.7.10 (http://styleguide.adventistas.org)
|
3
|
+
* Copyright 2014-2020 Igreja Adventista do Sétimo Dia
|
4
4
|
* Licensed under MIT (https://github.com/igrejaadventista/styleguide/blob/master/LICENSE)
|
5
5
|
*/
|
6
6
|
|
@@ -39,7 +39,500 @@ if(!jQuery)throw new Error("Bootstrap requires jQuery");+function(a){"use strict
|
|
39
39
|
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
40
40
|
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
41
41
|
|
42
|
-
(function($){var methods={init:function(options){var all=this;var instanceOptions=$.extend(true,{},$.fn.badonkatrunc.defaultOptions,options);if(instanceOptions.fitDirection!="horizontal"&&instanceOptions.fitDirection!="vertical"){$.error("'"+instanceOptions.fitDirection+"' is not a valid fit direction. Use 'horizontal' or 'vertical.'");return this;}if(instanceOptions.truncateLocation!="start"&&instanceOptions.truncateLocation!="middle"&&instanceOptions.truncateLocation!="end"){$.error("'"+instanceOptions.truncateLocation+"' is not a valid truncation location. Use 'start,' 'middle' or 'end.'");return this;}if(instanceOptions.minimumFontSize>instanceOptions.maximumFontSize){$.error("Minimum font size can not exceed the maximum font size.");return this;}if(instanceOptions.minimumLetterSpacing>instanceOptions.maximumLetterSpacing){$.error("Minimum letter spacing can not exceed the maximum letter spacing.");return this;}return this.each(function(){var $this=$(this);var data=$(this).data("badonkatrunc");if(data){$this.badonkatrunc("destroy");}var instance=pluginInstance($this,instanceOptions,all);$(this).data("badonkatrunc",instance);instance.init();if(instance.options.automaticSizeTracking){resizeMonitor.add(instance);}});},destroy:function(){return this.each(function(){var $this=$(this);var data=$this.data("badonkatrunc");data.destroy();resizeMonitor.remove(data);dirtyMonitor.remove(data);$(window).unbind(".badonkatrunc");$this.removeData("badonkatrunc");});},refresh:function(){return this.each(function(){var $this=$(this);var data=$this.data("badonkatrunc");dirtyMonitor.remove(data);data.refresh();});},changeContents:function(newContents){return this.each(function(){var $this=$(this);var data=$this.data("badonkatrunc");if(typeof(newContents)=="string"){data.contentHtml=$("<span></span>").text(newContents).html();}else{data.contentHtml=$(newContents).html();}dirtyMonitor.add(data);});}};$.fn.badonkatrunc=function(method){if(methods[method]){return methods[method].apply(this,Array.prototype.slice.call(arguments,1));}else{if(typeof method==="object"||!method){return methods.init.apply(this,arguments);}else{$.error("Method "+method+" does not exist on jQuery.badonkatrunc");}}};$.fn.badonkatrunc.settings={sizeTrackingTimeout:1000/60};$.fn.badonkatrunc.defaultOptions={automaticSizeTracking:false,fitDirection:"horizontal",minimumFontSize:1,maximumFontSize:1,fontSizeSynced:false,minimumLetterSpacing:0,maximumLetterSpacing:0,letterSpacingSynced:false,truncate:true,truncateString:"…",truncateLocation:"end",truncateOnlyWholeWords:false,extraOptimizeLimit:8};$.fn.btrunc=$.fn.badonkatrunc;var pluginInstance=function($target,options,$targetGroup){var createRenderState=function(content,fontSize,letterSpacing){return{content:content,fontSize:fontSize,letterSpacing:letterSpacing};};var instance={target:$target,options:options,refresh:function(){var self=this;var view=createHtmlTextView(this.contentHtml);var text=this.contentHtml;var fontSize=this.options.maximumFontSize;var letterSpacing=this.options.maximumLetterSpacing;var renderFunc=function(){var state=createRenderState(text,fontSize,letterSpacing);self.renderState(state);};var overflowFunc=function(){return self.getCurrentOverflow();};if(this.options.maximumFontSize-this.options.minimumFontSize>0){optimize(self.options.minimumFontSize,self.options.maximumFontSize,function(value){fontSize=value;renderFunc();},overflowFunc);}if(this.options.maximumLetterSpacing-this.options.minimumLetterSpacing>0){var truncationLevel=1;if(this.options.truncate){optimize(0,1,function(value){truncationLevel=value;text=getTruncatedHtml(view,self.options.truncateString,self.options.truncateLocation,value,true);optimize(self.options.minimumLetterSpacing,0,function(value){letterSpacing=value;renderFunc();},overflowFunc);renderFunc();},overflowFunc);}if(truncationLevel==1){optimize(self.options.minimumLetterSpacing,self.options.maximumLetterSpacing,function(value){letterSpacing=value;renderFunc();},overflowFunc);}}if(this.options.truncate){optimize(0,1,function(value){text=getTruncatedHtml(view,self.options.truncateString,self.options.truncateLocation,value,self.options.truncateOnlyWholeWords);renderFunc();},overflowFunc,this.options.extraOptimizeLimit);}this.renderState(createRenderState(text,fontSize,letterSpacing),!this.options.truncate);this.currentOptimalState=this.currentRenderedState;this.syncFonts();},syncFonts:function(){if($targetGroup.length>1&&(this.options.fontSizeSynced||this.options.letterSpacingSynced)){var lowestFontSize=this.currentOptimalState.fontSize;var lowestLetterSpacing=this.currentOptimalState.letterSpacing;for(var i=0;i<$targetGroup.length;i++){var groupInstance=$($targetGroup[i]).data("badonkatrunc");if(groupInstance!=null&&groupInstance.currentOptimalState!=null){if(groupInstance.currentOptimalState.fontSize<lowestFontSize){lowestFontSize=groupInstance.currentOptimalState.fontSize;}if(groupInstance.currentOptimalState.letterSpacing<lowestLetterSpacing){lowestLetterSpacing=groupInstance.currentOptimalState.letterSpacing;}}}for(var i=0;i<$targetGroup.length;i++){var groupInstance=$($targetGroup[i]).data("badonkatrunc");if(groupInstance!=null){groupInstance.acceptFontSync(lowestFontSize,lowestLetterSpacing);}}}},acceptFontSync:function(fontSize,letterSpacing){var self=this;var view=createHtmlTextView(this.contentHtml);var text=this.contentHtml;if(this.currentOptimalState!=null){if(!this.options.fontSizeSynced){fontSize=this.currentOptimalState.fontSize;}if(!this.options.letterSpacingSynced){letterSpacing=this.currentOptimalState.letterSpacing;}}var renderFunc=function(){self.renderState(createRenderState(text,fontSize,letterSpacing));};var overflowFunc=function(){return self.getCurrentOverflow();};if(this.options.truncate){optimize(0,1,function(value){text=getTruncatedHtml(view,self.options.truncateString,self.options.truncateLocation,value,self.options.truncateOnlyWholeWords);renderFunc();},overflowFunc);}this.renderState(createRenderState(text,fontSize,letterSpacing),!this.options.truncate);},init:function(){this.contentHtml=this.target.html();this.settingsWrapper=$('<span style="margin: 0px; padding: 0px; border: 0px;"></span>');this.settingsWrapper.addClass("badonkatrunc-wrapper");if(!$.browser.mozilla&&!$.browser.opera&&!($.browser.msie&&$.browser.version=="7.0")){this.settingsWrapper.css("display","block");}this.target.empty();this.target.append(this.settingsWrapper);this.refresh();},destroy:function(){this.target.empty();this.target.append(this.contentHtml);},renderState:function(state,forceAllowWrap){this.settingsWrapper.css("font-size",state.fontSize+"em");this.settingsWrapper.css("letter-spacing",state.letterSpacing+"em");var whiteSpace=(!forceAllowWrap&&this.options.fitDirection=="horizontal")?"nowrap":"normal";this.settingsWrapper.css("white-space",whiteSpace);this.settingsWrapper.empty();this.settingsWrapper.append(state.content);this.currentRenderedState=state;},getCurrentOverflow:function(){var wrapper=this.settingsWrapper[0];var overflow=(this.options.fitDirection=="horizontal")?wrapper.scrollWidth-$target.width():wrapper.offsetHeight-$target.height();return overflow;}};return instance;};var createDispatcher=function(updateFunc,addFunc,removeFunc,updateTimeout){var dispatcherInstance={_instances:[],_updateLoop:function(){if($.isFunction(updateFunc)){for(var i=0;i<dispatcherInstance._instances.length;i++){updateFunc(dispatcherInstance._instances[i]);}}if(updateTimeout!=null){if(dispatcherInstance._instances.length>0){setTimeout(dispatcherInstance._updateLoop,updateTimeout);}}else{dispatcherInstance._instances=[];}},add:function(instance){if($.inArray(instance,this._instances)!=-1){return;}if($.isFunction(addFunc)){addFunc(instance);}this._instances.push(instance);if(this._instances.length==1){if(updateTimeout==null){setTimeout(this._updateLoop);}else{this._updateLoop();}}},remove:function(instance){var index=$.inArray(instance,this._instances);if(index!=-1){this._instances.splice(index,1);if($.isFunction(removeFunc)){removeFunc(instance);}}}};return dispatcherInstance;};var resizeMonitor=createDispatcher(function(instance){instance.elementSizeCache.update();},function(instance){instance.elementSizeCache={width:null,height:null,update:function(){var newWidth=instance.target.width();var newHeight=instance.target.height();var hasChanged=((this.width!=null&&newWidth!=this.width)||(this.height!=null&&newHeight!=this.height));this.width=newWidth;this.height=newHeight;if(hasChanged){this.changed();}},changed:function(){dirtyMonitor.add(instance);}};},function(instance){instance.elementSizeCache=undefined;},$.fn.badonkatrunc.settings.sizeTrackingTimeout);var dirtyMonitor=createDispatcher(function(instance){instance.refresh.apply(instance);},null,null,null);var getTruncatedHtml=function(htmlTextView,truncateString,truncateLocation,amount,wordRounded){var text=htmlTextView.text;if(amount>1){amount=1;}if(amount<0){amount=0;}if(amount==1){return htmlTextView.html;}var getTruncatedRange=function(begin,length){var words=text.split(" ");var totalEntities=(wordRounded)?words.length:text.length;var entityBegin=totalEntities*begin;var entityLength=totalEntities*length;if(wordRounded){var getCharacterPosition=function(wordIndex){var characterCount=0;for(var i=0;i<wordIndex;i++){characterCount+=words[i].length+1;}return characterCount;};var endWord=entityBegin+entityLength;entityBegin=getCharacterPosition(entityBegin);entityLength=getCharacterPosition(endWord)-entityBegin;}return htmlTextView.getHtmlSubstring(entityBegin,entityLength);};switch(truncateLocation){case"middle":var amountPerSide=amount/2;var left=getTruncatedRange(0,amountPerSide);var right=getTruncatedRange(1-amountPerSide,amountPerSide);return $.trim(left)+" "+truncateString+" "+$.trim(right);case"start":var truncated=getTruncatedRange(1-amount,amount);return truncateString+$.trim(truncated);case"end":var truncated=getTruncatedRange(0,amount);return $.trim(truncated)+truncateString;}};var createHtmlTextView=function(contentHtml){var $content=$("<span></span>");$content.html(contentHtml);var view={html:contentHtml,text:$content.text(),getHtmlSubstring:function(index,length){var element=$content.clone()[0];var totalProcessedLength=0;var totalOutputLength=0;var nodesWithinRange=[];var withinRange=false;var stripOutOfRangeTextInElement=function(node){if(node.nodeType==3){var dataLength=node.data.length;var newData="";var wasWithinRange=false;for(var i=0;i<dataLength;i++){totalProcessedLength++;if(totalProcessedLength>=index&&totalOutputLength<length){withinRange=true;wasWithinRange=true;newData+=node.data.substr(i,1);totalOutputLength++;}else{if(withinRange==true){withinRange=false;}}}node.data=newData;if(wasWithinRange){nodesWithinRange.push(node);}}else{if(node.nodeType==1){if(withinRange){nodesWithinRange.push(node);}var childCount=node.childNodes.length;for(var i=0;i<childCount;i++){stripOutOfRangeTextInElement(node.childNodes[i]);}}}};stripOutOfRangeTextInElement(element);var parentNodesToKeep=[];var markParentNodesToKeep=function(element){var keepNode=function(node){parentNodesToKeep.push(node);if(node.parentNode!=null){keepNode(node.parentNode);}};keepNode(element);};var nodesWithinRangeCount=nodesWithinRange.length;for(var t=0;t<nodesWithinRangeCount;t++){markParentNodesToKeep(nodesWithinRange[t]);}var removeUnusedNodes=function(node){var nodesToRemove=[];var childNodeCount=node.childNodes.length;for(var i=0;i<childNodeCount;i++){var childNode=node.childNodes[i];if(childNode.nodeType!=3){if($.inArray(childNode,parentNodesToKeep)==-1){nodesToRemove.push(childNode);}else{removeUnusedNodes(childNode);}}}for(var i=0;i<nodesToRemove.length;i++){var node=nodesToRemove[i];node.parentNode.removeChild(node);}};removeUnusedNodes(element);return $(element).html();}};return view;};var optimize=function(min,max,actionFunc,overflowFunc,extraOptimizeLimit){var currentMax=max;var currentMin=min;var currentValue=max;var lastResult=null;var mostOptimalResult=null;var mostOptimalValue=null;var sameResultCount=0;while(true){actionFunc(currentValue);var result=overflowFunc();if(result<=0){var moreOptimal=true;if(mostOptimalResult!=null){if(mostOptimalResult>result){moreOptimal=false;}else{if(result==mostOptimalResult){if(currentValue<=mostOptimalValue){moreOptimal=false;}}}}if(moreOptimal){mostOptimalResult=result;mostOptimalValue=currentValue;}}if(result==lastResult){sameResultCount++;if(extraOptimizeLimit==undefined||sameResultCount==extraOptimizeLimit){if(mostOptimalValue!=null){actionFunc(mostOptimalValue);}return;}}if(result>0){currentMax=currentValue;var difference=(currentValue-currentMin);currentValue-=(difference/2);}else{if(result<=0){currentMin=currentValue;currentValue=currentMax;}}lastResult=result;}};})(jQuery);
|
42
|
+
//(function($){var methods={init:function(options){var all=this;var instanceOptions=$.extend(true,{},$.fn.badonkatrunc.defaultOptions,options);if(instanceOptions.fitDirection!="horizontal"&&instanceOptions.fitDirection!="vertical"){$.error("'"+instanceOptions.fitDirection+"' is not a valid fit direction. Use 'horizontal' or 'vertical.'");return this;}if(instanceOptions.truncateLocation!="start"&&instanceOptions.truncateLocation!="middle"&&instanceOptions.truncateLocation!="end"){$.error("'"+instanceOptions.truncateLocation+"' is not a valid truncation location. Use 'start,' 'middle' or 'end.'");return this;}if(instanceOptions.minimumFontSize>instanceOptions.maximumFontSize){$.error("Minimum font size can not exceed the maximum font size.");return this;}if(instanceOptions.minimumLetterSpacing>instanceOptions.maximumLetterSpacing){$.error("Minimum letter spacing can not exceed the maximum letter spacing.");return this;}return this.each(function(){var $this=$(this);var data=$(this).data("badonkatrunc");if(data){$this.badonkatrunc("destroy");}var instance=pluginInstance($this,instanceOptions,all);$(this).data("badonkatrunc",instance);instance.init();if(instance.options.automaticSizeTracking){resizeMonitor.add(instance);}});},destroy:function(){return this.each(function(){var $this=$(this);var data=$this.data("badonkatrunc");data.destroy();resizeMonitor.remove(data);dirtyMonitor.remove(data);$(window).unbind(".badonkatrunc");$this.removeData("badonkatrunc");});},refresh:function(){return this.each(function(){var $this=$(this);var data=$this.data("badonkatrunc");dirtyMonitor.remove(data);data.refresh();});},changeContents:function(newContents){return this.each(function(){var $this=$(this);var data=$this.data("badonkatrunc");if(typeof(newContents)=="string"){data.contentHtml=$("<span></span>").text(newContents).html();}else{data.contentHtml=$(newContents).html();}dirtyMonitor.add(data);});}};$.fn.badonkatrunc=function(method){if(methods[method]){return methods[method].apply(this,Array.prototype.slice.call(arguments,1));}else{if(typeof method==="object"||!method){return methods.init.apply(this,arguments);}else{$.error("Method "+method+" does not exist on jQuery.badonkatrunc");}}};$.fn.badonkatrunc.settings={sizeTrackingTimeout:1000/60};$.fn.badonkatrunc.defaultOptions={automaticSizeTracking:false,fitDirection:"horizontal",minimumFontSize:1,maximumFontSize:1,fontSizeSynced:false,minimumLetterSpacing:0,maximumLetterSpacing:0,letterSpacingSynced:false,truncate:true,truncateString:"…",truncateLocation:"end",truncateOnlyWholeWords:false,extraOptimizeLimit:8};$.fn.btrunc=$.fn.badonkatrunc;var pluginInstance=function($target,options,$targetGroup){var createRenderState=function(content,fontSize,letterSpacing){return{content:content,fontSize:fontSize,letterSpacing:letterSpacing};};var instance={target:$target,options:options,refresh:function(){var self=this;var view=createHtmlTextView(this.contentHtml);var text=this.contentHtml;var fontSize=this.options.maximumFontSize;var letterSpacing=this.options.maximumLetterSpacing;var renderFunc=function(){var state=createRenderState(text,fontSize,letterSpacing);self.renderState(state);};var overflowFunc=function(){return self.getCurrentOverflow();};if(this.options.maximumFontSize-this.options.minimumFontSize>0){optimize(self.options.minimumFontSize,self.options.maximumFontSize,function(value){fontSize=value;renderFunc();},overflowFunc);}if(this.options.maximumLetterSpacing-this.options.minimumLetterSpacing>0){var truncationLevel=1;if(this.options.truncate){optimize(0,1,function(value){truncationLevel=value;text=getTruncatedHtml(view,self.options.truncateString,self.options.truncateLocation,value,true);optimize(self.options.minimumLetterSpacing,0,function(value){letterSpacing=value;renderFunc();},overflowFunc);renderFunc();},overflowFunc);}if(truncationLevel==1){optimize(self.options.minimumLetterSpacing,self.options.maximumLetterSpacing,function(value){letterSpacing=value;renderFunc();},overflowFunc);}}if(this.options.truncate){optimize(0,1,function(value){text=getTruncatedHtml(view,self.options.truncateString,self.options.truncateLocation,value,self.options.truncateOnlyWholeWords);renderFunc();},overflowFunc,this.options.extraOptimizeLimit);}this.renderState(createRenderState(text,fontSize,letterSpacing),!this.options.truncate);this.currentOptimalState=this.currentRenderedState;this.syncFonts();},syncFonts:function(){if($targetGroup.length>1&&(this.options.fontSizeSynced||this.options.letterSpacingSynced)){var lowestFontSize=this.currentOptimalState.fontSize;var lowestLetterSpacing=this.currentOptimalState.letterSpacing;for(var i=0;i<$targetGroup.length;i++){var groupInstance=$($targetGroup[i]).data("badonkatrunc");if(groupInstance!=null&&groupInstance.currentOptimalState!=null){if(groupInstance.currentOptimalState.fontSize<lowestFontSize){lowestFontSize=groupInstance.currentOptimalState.fontSize;}if(groupInstance.currentOptimalState.letterSpacing<lowestLetterSpacing){lowestLetterSpacing=groupInstance.currentOptimalState.letterSpacing;}}}for(var i=0;i<$targetGroup.length;i++){var groupInstance=$($targetGroup[i]).data("badonkatrunc");if(groupInstance!=null){groupInstance.acceptFontSync(lowestFontSize,lowestLetterSpacing);}}}},acceptFontSync:function(fontSize,letterSpacing){var self=this;var view=createHtmlTextView(this.contentHtml);var text=this.contentHtml;if(this.currentOptimalState!=null){if(!this.options.fontSizeSynced){fontSize=this.currentOptimalState.fontSize;}if(!this.options.letterSpacingSynced){letterSpacing=this.currentOptimalState.letterSpacing;}}var renderFunc=function(){self.renderState(createRenderState(text,fontSize,letterSpacing));};var overflowFunc=function(){return self.getCurrentOverflow();};if(this.options.truncate){optimize(0,1,function(value){text=getTruncatedHtml(view,self.options.truncateString,self.options.truncateLocation,value,self.options.truncateOnlyWholeWords);renderFunc();},overflowFunc);}this.renderState(createRenderState(text,fontSize,letterSpacing),!this.options.truncate);},init:function(){this.contentHtml=this.target.html();this.settingsWrapper=$('<span style="margin: 0px; padding: 0px; border: 0px;"></span>');this.settingsWrapper.addClass("badonkatrunc-wrapper");if(!$.browser.mozilla&&!$.browser.opera&&!($.browser.msie&&$.browser.version=="7.0")){this.settingsWrapper.css("display","block");}this.target.empty();this.target.append(this.settingsWrapper);this.refresh();},destroy:function(){this.target.empty();this.target.append(this.contentHtml);},renderState:function(state,forceAllowWrap){this.settingsWrapper.css("font-size",state.fontSize+"em");this.settingsWrapper.css("letter-spacing",state.letterSpacing+"em");var whiteSpace=(!forceAllowWrap&&this.options.fitDirection=="horizontal")?"nowrap":"normal";this.settingsWrapper.css("white-space",whiteSpace);this.settingsWrapper.empty();this.settingsWrapper.append(state.content);this.currentRenderedState=state;},getCurrentOverflow:function(){var wrapper=this.settingsWrapper[0];var overflow=(this.options.fitDirection=="horizontal")?wrapper.scrollWidth-$target.width():wrapper.offsetHeight-$target.height();return overflow;}};return instance;};var createDispatcher=function(updateFunc,addFunc,removeFunc,updateTimeout){var dispatcherInstance={_instances:[],_updateLoop:function(){if($.isFunction(updateFunc)){for(var i=0;i<dispatcherInstance._instances.length;i++){updateFunc(dispatcherInstance._instances[i]);}}if(updateTimeout!=null){if(dispatcherInstance._instances.length>0){setTimeout(dispatcherInstance._updateLoop,updateTimeout);}}else{dispatcherInstance._instances=[];}},add:function(instance){if($.inArray(instance,this._instances)!=-1){return;}if($.isFunction(addFunc)){addFunc(instance);}this._instances.push(instance);if(this._instances.length==1){if(updateTimeout==null){setTimeout(this._updateLoop);}else{this._updateLoop();}}},remove:function(instance){var index=$.inArray(instance,this._instances);if(index!=-1){this._instances.splice(index,1);if($.isFunction(removeFunc)){removeFunc(instance);}}}};return dispatcherInstance;};var resizeMonitor=createDispatcher(function(instance){instance.elementSizeCache.update();},function(instance){instance.elementSizeCache={width:null,height:null,update:function(){var newWidth=instance.target.width();var newHeight=instance.target.height();var hasChanged=((this.width!=null&&newWidth!=this.width)||(this.height!=null&&newHeight!=this.height));this.width=newWidth;this.height=newHeight;if(hasChanged){this.changed();}},changed:function(){dirtyMonitor.add(instance);}};},function(instance){instance.elementSizeCache=undefined;},$.fn.badonkatrunc.settings.sizeTrackingTimeout);var dirtyMonitor=createDispatcher(function(instance){instance.refresh.apply(instance);},null,null,null);var getTruncatedHtml=function(htmlTextView,truncateString,truncateLocation,amount,wordRounded){var text=htmlTextView.text;if(amount>1){amount=1;}if(amount<0){amount=0;}if(amount==1){return htmlTextView.html;}var getTruncatedRange=function(begin,length){var words=text.split(" ");var totalEntities=(wordRounded)?words.length:text.length;var entityBegin=totalEntities*begin;var entityLength=totalEntities*length;if(wordRounded){var getCharacterPosition=function(wordIndex){var characterCount=0;for(var i=0;i<wordIndex;i++){characterCount+=words[i].length+1;}return characterCount;};var endWord=entityBegin+entityLength;entityBegin=getCharacterPosition(entityBegin);entityLength=getCharacterPosition(endWord)-entityBegin;}return htmlTextView.getHtmlSubstring(entityBegin,entityLength);};switch(truncateLocation){case"middle":var amountPerSide=amount/2;var left=getTruncatedRange(0,amountPerSide);var right=getTruncatedRange(1-amountPerSide,amountPerSide);return $.trim(left)+" "+truncateString+" "+$.trim(right);case"start":var truncated=getTruncatedRange(1-amount,amount);return truncateString+$.trim(truncated);case"end":var truncated=getTruncatedRange(0,amount);return $.trim(truncated)+truncateString;}};var createHtmlTextView=function(contentHtml){var $content=$("<span></span>");$content.html(contentHtml);var view={html:contentHtml,text:$content.text(),getHtmlSubstring:function(index,length){var element=$content.clone()[0];var totalProcessedLength=0;var totalOutputLength=0;var nodesWithinRange=[];var withinRange=false;var stripOutOfRangeTextInElement=function(node){if(node.nodeType==3){var dataLength=node.data.length;var newData="";var wasWithinRange=false;for(var i=0;i<dataLength;i++){totalProcessedLength++;if(totalProcessedLength>=index&&totalOutputLength<length){withinRange=true;wasWithinRange=true;newData+=node.data.substr(i,1);totalOutputLength++;}else{if(withinRange==true){withinRange=false;}}}node.data=newData;if(wasWithinRange){nodesWithinRange.push(node);}}else{if(node.nodeType==1){if(withinRange){nodesWithinRange.push(node);}var childCount=node.childNodes.length;for(var i=0;i<childCount;i++){stripOutOfRangeTextInElement(node.childNodes[i]);}}}};stripOutOfRangeTextInElement(element);var parentNodesToKeep=[];var markParentNodesToKeep=function(element){var keepNode=function(node){parentNodesToKeep.push(node);if(node.parentNode!=null){keepNode(node.parentNode);}};keepNode(element);};var nodesWithinRangeCount=nodesWithinRange.length;for(var t=0;t<nodesWithinRangeCount;t++){markParentNodesToKeep(nodesWithinRange[t]);}var removeUnusedNodes=function(node){var nodesToRemove=[];var childNodeCount=node.childNodes.length;for(var i=0;i<childNodeCount;i++){var childNode=node.childNodes[i];if(childNode.nodeType!=3){if($.inArray(childNode,parentNodesToKeep)==-1){nodesToRemove.push(childNode);}else{removeUnusedNodes(childNode);}}}for(var i=0;i<nodesToRemove.length;i++){var node=nodesToRemove[i];node.parentNode.removeChild(node);}};removeUnusedNodes(element);return $(element).html();}};return view;};var optimize=function(min,max,actionFunc,overflowFunc,extraOptimizeLimit){var currentMax=max;var currentMin=min;var currentValue=max;var lastResult=null;var mostOptimalResult=null;var mostOptimalValue=null;var sameResultCount=0;while(true){actionFunc(currentValue);var result=overflowFunc();if(result<=0){var moreOptimal=true;if(mostOptimalResult!=null){if(mostOptimalResult>result){moreOptimal=false;}else{if(result==mostOptimalResult){if(currentValue<=mostOptimalValue){moreOptimal=false;}}}}if(moreOptimal){mostOptimalResult=result;mostOptimalValue=currentValue;}}if(result==lastResult){sameResultCount++;if(extraOptimizeLimit==undefined||sameResultCount==extraOptimizeLimit){if(mostOptimalValue!=null){actionFunc(mostOptimalValue);}return;}}if(result>0){currentMax=currentValue;var difference=(currentValue-currentMin);currentValue-=(difference/2);}else{if(result<=0){currentMin=currentValue;currentValue=currentMax;}}lastResult=result;}};})(jQuery);
|
43
|
+
|
44
|
+
|
45
|
+
(function ($) {
|
46
|
+
var methods = {
|
47
|
+
init: function (options) {
|
48
|
+
var all = this;
|
49
|
+
var instanceOptions = $.extend(true, {}, $.fn.badonkatrunc.defaultOptions, options);
|
50
|
+
if (instanceOptions.fitDirection != "horizontal" && instanceOptions.fitDirection != "vertical") {
|
51
|
+
$.error("'" + instanceOptions.fitDirection + "' is not a valid fit direction. Use 'horizontal' or 'vertical.'");
|
52
|
+
return this;
|
53
|
+
}
|
54
|
+
if (instanceOptions.truncateLocation != "start" && instanceOptions.truncateLocation != "middle" && instanceOptions.truncateLocation != "end") {
|
55
|
+
$.error("'" + instanceOptions.truncateLocation + "' is not a valid truncation location. Use 'start,' 'middle' or 'end.'");
|
56
|
+
return this;
|
57
|
+
}
|
58
|
+
if (instanceOptions.minimumFontSize > instanceOptions.maximumFontSize) {
|
59
|
+
$.error("Minimum font size can not exceed the maximum font size.");
|
60
|
+
return this;
|
61
|
+
}
|
62
|
+
if (instanceOptions.minimumLetterSpacing > instanceOptions.maximumLetterSpacing) {
|
63
|
+
$.error("Minimum letter spacing can not exceed the maximum letter spacing.");
|
64
|
+
return this;
|
65
|
+
}
|
66
|
+
return this.each(function () {
|
67
|
+
var $this = $(this);
|
68
|
+
var data = $(this).data("badonkatrunc");
|
69
|
+
if (data) {
|
70
|
+
$this.badonkatrunc("destroy");
|
71
|
+
}
|
72
|
+
var instance = pluginInstance($this, instanceOptions, all);
|
73
|
+
$(this).data("badonkatrunc", instance);
|
74
|
+
instance.init();
|
75
|
+
if (instance.options.automaticSizeTracking) {
|
76
|
+
resizeMonitor.add(instance);
|
77
|
+
}
|
78
|
+
});
|
79
|
+
},
|
80
|
+
destroy: function () {
|
81
|
+
return this.each(function () {
|
82
|
+
var $this = $(this);
|
83
|
+
var data = $this.data("badonkatrunc");
|
84
|
+
data.destroy();
|
85
|
+
resizeMonitor.remove(data);
|
86
|
+
dirtyMonitor.remove(data);
|
87
|
+
$(window).unbind(".badonkatrunc");
|
88
|
+
$this.removeData("badonkatrunc");
|
89
|
+
});
|
90
|
+
},
|
91
|
+
refresh: function () {
|
92
|
+
return this.each(function () {
|
93
|
+
var $this = $(this);
|
94
|
+
var data = $this.data("badonkatrunc");
|
95
|
+
dirtyMonitor.remove(data);
|
96
|
+
data.refresh();
|
97
|
+
});
|
98
|
+
},
|
99
|
+
changeContents: function (newContents) {
|
100
|
+
return this.each(function () {
|
101
|
+
var $this = $(this);
|
102
|
+
var data = $this.data("badonkatrunc");
|
103
|
+
if (typeof (newContents) == "string") {
|
104
|
+
data.contentHtml = $("<span></span>").text(newContents).html();
|
105
|
+
} else {
|
106
|
+
data.contentHtml = $(newContents).html();
|
107
|
+
}
|
108
|
+
dirtyMonitor.add(data);
|
109
|
+
});
|
110
|
+
}
|
111
|
+
};
|
112
|
+
$.fn.badonkatrunc = function (method) {
|
113
|
+
if (methods[method]) {
|
114
|
+
return methods[method].apply(this, Array.prototype.slice.call(arguments, 1));
|
115
|
+
} else {
|
116
|
+
if (typeof method === "object" || !method) {
|
117
|
+
return methods.init.apply(this, arguments);
|
118
|
+
} else {
|
119
|
+
$.error("Method " + method + " does not exist on jQuery.badonkatrunc");
|
120
|
+
}
|
121
|
+
}
|
122
|
+
};
|
123
|
+
$.fn.badonkatrunc.settings = {
|
124
|
+
sizeTrackingTimeout: 1000 / 60
|
125
|
+
};
|
126
|
+
$.fn.badonkatrunc.defaultOptions = {
|
127
|
+
automaticSizeTracking: false,
|
128
|
+
fitDirection: "horizontal",
|
129
|
+
minimumFontSize: 1,
|
130
|
+
maximumFontSize: 1,
|
131
|
+
fontSizeSynced: false,
|
132
|
+
minimumLetterSpacing: 0,
|
133
|
+
maximumLetterSpacing: 0,
|
134
|
+
letterSpacingSynced: false,
|
135
|
+
truncate: true,
|
136
|
+
truncateString: "…",
|
137
|
+
truncateLocation: "end",
|
138
|
+
truncateOnlyWholeWords: false,
|
139
|
+
extraOptimizeLimit: 8
|
140
|
+
};
|
141
|
+
$.fn.btrunc = $.fn.badonkatrunc;
|
142
|
+
var pluginInstance = function ($target, options, $targetGroup) {
|
143
|
+
var createRenderState = function (content, fontSize, letterSpacing) {
|
144
|
+
return {
|
145
|
+
content: content,
|
146
|
+
fontSize: fontSize,
|
147
|
+
letterSpacing: letterSpacing
|
148
|
+
};
|
149
|
+
};
|
150
|
+
var instance = {
|
151
|
+
target: $target,
|
152
|
+
options: options,
|
153
|
+
refresh: function () {
|
154
|
+
var self = this;
|
155
|
+
var view = createHtmlTextView(this.contentHtml);
|
156
|
+
var text = this.contentHtml;
|
157
|
+
var fontSize = this.options.maximumFontSize;
|
158
|
+
var letterSpacing = this.options.maximumLetterSpacing;
|
159
|
+
var renderFunc = function () {
|
160
|
+
var state = createRenderState(text, fontSize, letterSpacing);
|
161
|
+
self.renderState(state);
|
162
|
+
};
|
163
|
+
var overflowFunc = function () {
|
164
|
+
return self.getCurrentOverflow();
|
165
|
+
};
|
166
|
+
if (this.options.maximumFontSize - this.options.minimumFontSize > 0) {
|
167
|
+
optimize(self.options.minimumFontSize, self.options.maximumFontSize, function (value) {
|
168
|
+
fontSize = value;
|
169
|
+
renderFunc();
|
170
|
+
}, overflowFunc);
|
171
|
+
}
|
172
|
+
if (this.options.maximumLetterSpacing - this.options.minimumLetterSpacing > 0) {
|
173
|
+
var truncationLevel = 1;
|
174
|
+
if (this.options.truncate) {
|
175
|
+
optimize(0, 1, function (value) {
|
176
|
+
truncationLevel = value;
|
177
|
+
text = getTruncatedHtml(view, self.options.truncateString, self.options.truncateLocation, value, true);
|
178
|
+
optimize(self.options.minimumLetterSpacing, 0, function (value) {
|
179
|
+
letterSpacing = value;
|
180
|
+
renderFunc();
|
181
|
+
}, overflowFunc);
|
182
|
+
renderFunc();
|
183
|
+
}, overflowFunc);
|
184
|
+
}
|
185
|
+
if (truncationLevel == 1) {
|
186
|
+
optimize(self.options.minimumLetterSpacing, self.options.maximumLetterSpacing, function (value) {
|
187
|
+
letterSpacing = value;
|
188
|
+
renderFunc();
|
189
|
+
}, overflowFunc);
|
190
|
+
}
|
191
|
+
}
|
192
|
+
if (this.options.truncate) {
|
193
|
+
optimize(0, 1, function (value) {
|
194
|
+
text = getTruncatedHtml(view, self.options.truncateString, self.options.truncateLocation, value, self.options.truncateOnlyWholeWords);
|
195
|
+
renderFunc();
|
196
|
+
}, overflowFunc, this.options.extraOptimizeLimit);
|
197
|
+
}
|
198
|
+
this.renderState(createRenderState(text, fontSize, letterSpacing), !this.options.truncate);
|
199
|
+
this.currentOptimalState = this.currentRenderedState;
|
200
|
+
this.syncFonts();
|
201
|
+
},
|
202
|
+
syncFonts: function () {
|
203
|
+
if ($targetGroup.length > 1 && (this.options.fontSizeSynced || this.options.letterSpacingSynced)) {
|
204
|
+
var lowestFontSize = this.currentOptimalState.fontSize;
|
205
|
+
var lowestLetterSpacing = this.currentOptimalState.letterSpacing;
|
206
|
+
for (var i = 0; i < $targetGroup.length; i++) {
|
207
|
+
var groupInstance = $($targetGroup[i]).data("badonkatrunc");
|
208
|
+
if (groupInstance != null && groupInstance.currentOptimalState != null) {
|
209
|
+
if (groupInstance.currentOptimalState.fontSize < lowestFontSize) {
|
210
|
+
lowestFontSize = groupInstance.currentOptimalState.fontSize;
|
211
|
+
}
|
212
|
+
if (groupInstance.currentOptimalState.letterSpacing < lowestLetterSpacing) {
|
213
|
+
lowestLetterSpacing = groupInstance.currentOptimalState.letterSpacing;
|
214
|
+
}
|
215
|
+
}
|
216
|
+
}
|
217
|
+
for (var i = 0; i < $targetGroup.length; i++) {
|
218
|
+
var groupInstance = $($targetGroup[i]).data("badonkatrunc");
|
219
|
+
if (groupInstance != null) {
|
220
|
+
groupInstance.acceptFontSync(lowestFontSize, lowestLetterSpacing);
|
221
|
+
}
|
222
|
+
}
|
223
|
+
}
|
224
|
+
},
|
225
|
+
acceptFontSync: function (fontSize, letterSpacing) {
|
226
|
+
var self = this;
|
227
|
+
var view = createHtmlTextView(this.contentHtml);
|
228
|
+
var text = this.contentHtml;
|
229
|
+
if (this.currentOptimalState != null) {
|
230
|
+
if (!this.options.fontSizeSynced) {
|
231
|
+
fontSize = this.currentOptimalState.fontSize;
|
232
|
+
}
|
233
|
+
if (!this.options.letterSpacingSynced) {
|
234
|
+
letterSpacing = this.currentOptimalState.letterSpacing;
|
235
|
+
}
|
236
|
+
}
|
237
|
+
var renderFunc = function () {
|
238
|
+
self.renderState(createRenderState(text, fontSize, letterSpacing));
|
239
|
+
};
|
240
|
+
var overflowFunc = function () {
|
241
|
+
return self.getCurrentOverflow();
|
242
|
+
};
|
243
|
+
if (this.options.truncate) {
|
244
|
+
optimize(0, 1, function (value) {
|
245
|
+
text = getTruncatedHtml(view, self.options.truncateString, self.options.truncateLocation, value, self.options.truncateOnlyWholeWords);
|
246
|
+
renderFunc();
|
247
|
+
}, overflowFunc);
|
248
|
+
}
|
249
|
+
this.renderState(createRenderState(text, fontSize, letterSpacing), !this.options.truncate);
|
250
|
+
},
|
251
|
+
init: function () {
|
252
|
+
|
253
|
+
if (!$.browser.mozilla && !$.browser.opera && !($.browser.msie && $.browser.version == "7.0")) {
|
254
|
+
this.contentHtml = this.target.html();
|
255
|
+
this.settingsWrapper = $('<span style="margin: 0px; padding: 0px; border: 0px;"></span>');
|
256
|
+
this.settingsWrapper.addClass("badonkatrunc-wrapper");
|
257
|
+
this.settingsWrapper.css("display", "block");
|
258
|
+
}
|
259
|
+
//this.target.empty();
|
260
|
+
this.target.append(this.settingsWrapper);
|
261
|
+
this.refresh();
|
262
|
+
},
|
263
|
+
destroy: function () {
|
264
|
+
this.target.empty();
|
265
|
+
this.target.append(this.contentHtml);
|
266
|
+
},
|
267
|
+
renderState: function (state, forceAllowWrap) {
|
268
|
+
this.settingsWrapper.css("font-size", state.fontSize + "em");
|
269
|
+
this.settingsWrapper.css("letter-spacing", state.letterSpacing + "em");
|
270
|
+
var whiteSpace = (!forceAllowWrap && this.options.fitDirection == "horizontal") ? "nowrap" : "normal";
|
271
|
+
this.settingsWrapper.css("white-space", whiteSpace);
|
272
|
+
this.settingsWrapper.empty();
|
273
|
+
this.settingsWrapper.append(state.content);
|
274
|
+
this.currentRenderedState = state;
|
275
|
+
},
|
276
|
+
getCurrentOverflow: function () {
|
277
|
+
var wrapper = this.settingsWrapper[0];
|
278
|
+
var overflow = (this.options.fitDirection == "horizontal") ? wrapper.scrollWidth - $target.width() : wrapper.offsetHeight - $target.height();
|
279
|
+
return overflow;
|
280
|
+
}
|
281
|
+
};
|
282
|
+
return instance;
|
283
|
+
};
|
284
|
+
var createDispatcher = function (updateFunc, addFunc, removeFunc, updateTimeout) {
|
285
|
+
var dispatcherInstance = {
|
286
|
+
_instances: [],
|
287
|
+
_updateLoop: function () {
|
288
|
+
if ($.isFunction(updateFunc)) {
|
289
|
+
for (var i = 0; i < dispatcherInstance._instances.length; i++) {
|
290
|
+
updateFunc(dispatcherInstance._instances[i]);
|
291
|
+
}
|
292
|
+
}
|
293
|
+
if (updateTimeout != null) {
|
294
|
+
if (dispatcherInstance._instances.length > 0) {
|
295
|
+
setTimeout(dispatcherInstance._updateLoop, updateTimeout);
|
296
|
+
}
|
297
|
+
} else {
|
298
|
+
dispatcherInstance._instances = [];
|
299
|
+
}
|
300
|
+
},
|
301
|
+
add: function (instance) {
|
302
|
+
if ($.inArray(instance, this._instances) != -1) {
|
303
|
+
return;
|
304
|
+
}
|
305
|
+
if ($.isFunction(addFunc)) {
|
306
|
+
addFunc(instance);
|
307
|
+
}
|
308
|
+
this._instances.push(instance);
|
309
|
+
if (this._instances.length == 1) {
|
310
|
+
if (updateTimeout == null) {
|
311
|
+
setTimeout(this._updateLoop);
|
312
|
+
} else {
|
313
|
+
this._updateLoop();
|
314
|
+
}
|
315
|
+
}
|
316
|
+
},
|
317
|
+
remove: function (instance) {
|
318
|
+
var index = $.inArray(instance, this._instances);
|
319
|
+
if (index != -1) {
|
320
|
+
this._instances.splice(index, 1);
|
321
|
+
if ($.isFunction(removeFunc)) {
|
322
|
+
removeFunc(instance);
|
323
|
+
}
|
324
|
+
}
|
325
|
+
}
|
326
|
+
};
|
327
|
+
return dispatcherInstance;
|
328
|
+
};
|
329
|
+
var resizeMonitor = createDispatcher(function (instance) {
|
330
|
+
instance.elementSizeCache.update();
|
331
|
+
}, function (instance) {
|
332
|
+
instance.elementSizeCache = {
|
333
|
+
width: null,
|
334
|
+
height: null,
|
335
|
+
update: function () {
|
336
|
+
var newWidth = instance.target.width();
|
337
|
+
var newHeight = instance.target.height();
|
338
|
+
var hasChanged = ((this.width != null && newWidth != this.width) || (this.height != null && newHeight != this.height));
|
339
|
+
this.width = newWidth;
|
340
|
+
this.height = newHeight;
|
341
|
+
if (hasChanged) {
|
342
|
+
this.changed();
|
343
|
+
}
|
344
|
+
},
|
345
|
+
changed: function () {
|
346
|
+
dirtyMonitor.add(instance);
|
347
|
+
}
|
348
|
+
};
|
349
|
+
}, function (instance) {
|
350
|
+
instance.elementSizeCache = undefined;
|
351
|
+
}, $.fn.badonkatrunc.settings.sizeTrackingTimeout);
|
352
|
+
var dirtyMonitor = createDispatcher(function (instance) {
|
353
|
+
instance.refresh.apply(instance);
|
354
|
+
}, null, null, null);
|
355
|
+
var getTruncatedHtml = function (htmlTextView, truncateString, truncateLocation, amount, wordRounded) {
|
356
|
+
var text = htmlTextView.text;
|
357
|
+
if (amount > 1) {
|
358
|
+
amount = 1;
|
359
|
+
}
|
360
|
+
if (amount < 0) {
|
361
|
+
amount = 0;
|
362
|
+
}
|
363
|
+
if (amount == 1) {
|
364
|
+
return htmlTextView.html;
|
365
|
+
}
|
366
|
+
var getTruncatedRange = function (begin, length) {
|
367
|
+
var words = text.split(" ");
|
368
|
+
var totalEntities = (wordRounded) ? words.length : text.length;
|
369
|
+
var entityBegin = totalEntities * begin;
|
370
|
+
var entityLength = totalEntities * length;
|
371
|
+
if (wordRounded) {
|
372
|
+
var getCharacterPosition = function (wordIndex) {
|
373
|
+
var characterCount = 0;
|
374
|
+
for (var i = 0; i < wordIndex; i++) {
|
375
|
+
characterCount += words[i].length + 1;
|
376
|
+
}
|
377
|
+
return characterCount;
|
378
|
+
};
|
379
|
+
var endWord = entityBegin + entityLength;
|
380
|
+
entityBegin = getCharacterPosition(entityBegin);
|
381
|
+
entityLength = getCharacterPosition(endWord) - entityBegin;
|
382
|
+
}
|
383
|
+
return htmlTextView.getHtmlSubstring(entityBegin, entityLength);
|
384
|
+
};
|
385
|
+
switch (truncateLocation) {
|
386
|
+
case "middle":
|
387
|
+
var amountPerSide = amount / 2;
|
388
|
+
var left = getTruncatedRange(0, amountPerSide);
|
389
|
+
var right = getTruncatedRange(1 - amountPerSide, amountPerSide);
|
390
|
+
return $.trim(left) + " " + truncateString + " " + $.trim(right);
|
391
|
+
case "start":
|
392
|
+
var truncated = getTruncatedRange(1 - amount, amount);
|
393
|
+
return truncateString + $.trim(truncated);
|
394
|
+
case "end":
|
395
|
+
var truncated = getTruncatedRange(0, amount);
|
396
|
+
return $.trim(truncated) + truncateString;
|
397
|
+
}
|
398
|
+
};
|
399
|
+
var createHtmlTextView = function (contentHtml) {
|
400
|
+
var $content = $("<span></span>");
|
401
|
+
$content.html(contentHtml);
|
402
|
+
var view = {
|
403
|
+
html: contentHtml,
|
404
|
+
text: $content.text(),
|
405
|
+
getHtmlSubstring: function (index, length) {
|
406
|
+
var element = $content.clone()[0];
|
407
|
+
var totalProcessedLength = 0;
|
408
|
+
var totalOutputLength = 0;
|
409
|
+
var nodesWithinRange = [];
|
410
|
+
var withinRange = false;
|
411
|
+
var stripOutOfRangeTextInElement = function (node) {
|
412
|
+
if (node.nodeType == 3) {
|
413
|
+
var dataLength = node.data.length;
|
414
|
+
var newData = "";
|
415
|
+
var wasWithinRange = false;
|
416
|
+
for (var i = 0; i < dataLength; i++) {
|
417
|
+
totalProcessedLength++;
|
418
|
+
if (totalProcessedLength >= index && totalOutputLength < length) {
|
419
|
+
withinRange = true;
|
420
|
+
wasWithinRange = true;
|
421
|
+
newData += node.data.substr(i, 1);
|
422
|
+
totalOutputLength++;
|
423
|
+
} else {
|
424
|
+
if (withinRange == true) {
|
425
|
+
withinRange = false;
|
426
|
+
}
|
427
|
+
}
|
428
|
+
}
|
429
|
+
node.data = newData;
|
430
|
+
if (wasWithinRange) {
|
431
|
+
nodesWithinRange.push(node);
|
432
|
+
}
|
433
|
+
} else {
|
434
|
+
if (node.nodeType == 1) {
|
435
|
+
if (withinRange) {
|
436
|
+
nodesWithinRange.push(node);
|
437
|
+
}
|
438
|
+
var childCount = node.childNodes.length;
|
439
|
+
for (var i = 0; i < childCount; i++) {
|
440
|
+
stripOutOfRangeTextInElement(node.childNodes[i]);
|
441
|
+
}
|
442
|
+
}
|
443
|
+
}
|
444
|
+
};
|
445
|
+
stripOutOfRangeTextInElement(element);
|
446
|
+
var parentNodesToKeep = [];
|
447
|
+
var markParentNodesToKeep = function (element) {
|
448
|
+
var keepNode = function (node) {
|
449
|
+
parentNodesToKeep.push(node);
|
450
|
+
if (node.parentNode != null) {
|
451
|
+
keepNode(node.parentNode);
|
452
|
+
}
|
453
|
+
};
|
454
|
+
keepNode(element);
|
455
|
+
};
|
456
|
+
var nodesWithinRangeCount = nodesWithinRange.length;
|
457
|
+
for (var t = 0; t < nodesWithinRangeCount; t++) {
|
458
|
+
markParentNodesToKeep(nodesWithinRange[t]);
|
459
|
+
}
|
460
|
+
var removeUnusedNodes = function (node) {
|
461
|
+
var nodesToRemove = [];
|
462
|
+
var childNodeCount = node.childNodes.length;
|
463
|
+
for (var i = 0; i < childNodeCount; i++) {
|
464
|
+
var childNode = node.childNodes[i];
|
465
|
+
if (childNode.nodeType != 3) {
|
466
|
+
if ($.inArray(childNode, parentNodesToKeep) == -1) {
|
467
|
+
nodesToRemove.push(childNode);
|
468
|
+
} else {
|
469
|
+
removeUnusedNodes(childNode);
|
470
|
+
}
|
471
|
+
}
|
472
|
+
}
|
473
|
+
for (var i = 0; i < nodesToRemove.length; i++) {
|
474
|
+
var node = nodesToRemove[i];
|
475
|
+
node.parentNode.removeChild(node);
|
476
|
+
}
|
477
|
+
};
|
478
|
+
removeUnusedNodes(element);
|
479
|
+
return $(element).html();
|
480
|
+
}
|
481
|
+
};
|
482
|
+
return view;
|
483
|
+
};
|
484
|
+
var optimize = function (min, max, actionFunc, overflowFunc, extraOptimizeLimit) {
|
485
|
+
var currentMax = max;
|
486
|
+
var currentMin = min;
|
487
|
+
var currentValue = max;
|
488
|
+
var lastResult = null;
|
489
|
+
var mostOptimalResult = null;
|
490
|
+
var mostOptimalValue = null;
|
491
|
+
var sameResultCount = 0;
|
492
|
+
while (true) {
|
493
|
+
actionFunc(currentValue);
|
494
|
+
var result = overflowFunc();
|
495
|
+
if (result <= 0) {
|
496
|
+
var moreOptimal = true;
|
497
|
+
if (mostOptimalResult != null) {
|
498
|
+
if (mostOptimalResult > result) {
|
499
|
+
moreOptimal = false;
|
500
|
+
} else {
|
501
|
+
if (result == mostOptimalResult) {
|
502
|
+
if (currentValue <= mostOptimalValue) {
|
503
|
+
moreOptimal = false;
|
504
|
+
}
|
505
|
+
}
|
506
|
+
}
|
507
|
+
}
|
508
|
+
if (moreOptimal) {
|
509
|
+
mostOptimalResult = result;
|
510
|
+
mostOptimalValue = currentValue;
|
511
|
+
}
|
512
|
+
}
|
513
|
+
if (result == lastResult) {
|
514
|
+
sameResultCount++;
|
515
|
+
if (extraOptimizeLimit == undefined || sameResultCount == extraOptimizeLimit) {
|
516
|
+
if (mostOptimalValue != null) {
|
517
|
+
actionFunc(mostOptimalValue);
|
518
|
+
}
|
519
|
+
return;
|
520
|
+
}
|
521
|
+
}
|
522
|
+
if (result > 0) {
|
523
|
+
currentMax = currentValue;
|
524
|
+
var difference = (currentValue - currentMin);
|
525
|
+
currentValue -= (difference / 2);
|
526
|
+
} else {
|
527
|
+
if (result <= 0) {
|
528
|
+
currentMin = currentValue;
|
529
|
+
currentValue = currentMax;
|
530
|
+
}
|
531
|
+
}
|
532
|
+
lastResult = result;
|
533
|
+
}
|
534
|
+
};
|
535
|
+
})(jQuery);
|
43
536
|
/*
|
44
537
|
* jQuery OwlCarousel v1.3.2
|
45
538
|
*
|
@@ -1892,6 +2385,7 @@ if (!window.matchMedia){ window.matchMedia = function(){ return { matches:false
|
|
1892
2385
|
$(document).ready(function (){
|
1893
2386
|
widgets.handleEvents();
|
1894
2387
|
owlPlugin.initPostCarousel();
|
2388
|
+
owlPlugin.initServiceCarouselFull();
|
1895
2389
|
owlPlugin.initServiceCarouselLarge();
|
1896
2390
|
owlPlugin.initServiceCarouselSmall();
|
1897
2391
|
owlPlugin.initGalleriesCarousel();
|
@@ -1948,6 +2442,23 @@ if (!window.matchMedia){ window.matchMedia = function(){ return { matches:false
|
|
1948
2442
|
}
|
1949
2443
|
},
|
1950
2444
|
|
2445
|
+
initServiceCarouselFull : function(){
|
2446
|
+
var element = $(".iasd-widget-slider > .services.full");
|
2447
|
+
if(element.length > 0) {
|
2448
|
+
owlCarousels.push(element.owlCarousel({
|
2449
|
+
items : 7,
|
2450
|
+
itemsDesktop : [1200,7],
|
2451
|
+
itemsDesktopSmall : [991,7],
|
2452
|
+
itemsTablet : [768,5],
|
2453
|
+
itemsMobile: [479,3],
|
2454
|
+
slideSpeed : 500,
|
2455
|
+
paginationSpeed : 1000,
|
2456
|
+
autoPlay: false,
|
2457
|
+
stopOnHover: true
|
2458
|
+
}).data('owlCarousel'));
|
2459
|
+
}
|
2460
|
+
},
|
2461
|
+
|
1951
2462
|
initServiceCarouselLarge : function(){
|
1952
2463
|
var element = $(".iasd-widget-slider > .services.large");
|
1953
2464
|
if(element.length > 0) {
|