1function YrmMore() { 2 3 this.data = []; 4} 5 6YrmMore.prototype.setData = function (dataName, value) { 7 8 this.data[dataName] = value; 9}; 10 11YrmMore.prototype.getData = function(dataName) { 12 13 return this.data[dataName]; 14}; 15 16YrmMore.prototype.binding = function() { 17 var thaT = this; 18 19 this.styles(); 20 21}; 22 23YrmMore.prototype.setStyles = function () { 24 25 var data = this.getData('readMoreData'); 26 var id = this.getData('id'); 27 28 this.setChengHorizontalAlign(".yrm-btn-wrapper-"+id,data['horizontal']); 29 30 this.setFontSize(".yrm-button-text-"+id, data['font-size']); 31 this.setFontWeight(".yrm-button-text-"+id, data['yrm-btn-font-weight']); 32 if(typeof this.proInit == 'function') { 33 this.proInit(); 34 } 35 if(typeof this.generalFunctions == 'function') { 36 this.generalFunctions(); 37 } 38 39 if(data['yrm-btn-hover-animate']) { 40 jQuery('.yrm-toggle-expand-'+id).attr('data-animate', 'animated '+data['yrm-btn-hover-animate']); 41 } 42 43 this.buttonHoverEffect(); 44}; 45 46YrmMore.prototype.buttonHoverEffect = function() { 47 var id = this.getData('id'); 48 jQuery('.yrm-toggle-expand-'+id).hover(function() { 49 var effect = jQuery(this).attr('data-animate'); 50 jQuery(this).addClass(effect); 51 }, function() { 52 var effect = jQuery(this).attr('data-animate'); 53 jQuery(this).removeClass(effect); 54 }) 55}; 56 57YrmMore.prototype.buttonDimensions = function() { 58 59 var data = this.getData('readMoreData'); 60 var id = this.getData('id'); 61 62 var width = data['button-width']; 63 var height = data['button-height']; 64 65 jQuery(".yrm-toggle-expand-"+id).css({ 66 'width': width, 67 'height': height 68 }); 69}; 70 71YrmMore.prototype.styles = function() { 72 73 var data = this.getData('readMoreData'); 74 var fontSize = data['font-size']; 75 76 this.setFontSize(".yrm-button-text", fontSize); 77}; 78 79YrmMore.prototype.setFontSize = function (element, fontSize) { 80 81 jQuery(element).css({ 82 'font-size': fontSize 83 }) 84}; 85 86YrmMore.prototype.setFontWeight = function (element, fontWeight) { 87 88 jQuery(element).css({ 89 'font-weight': fontWeight 90 }) 91}; 92 93YrmMore.prototype.setChengHorizontalAlign = function(element, val) { 94 95 jQuery(element).css({"text-align": val}); 96 var data = this.getData('readMoreData'); 97 if(data['type'] == 'inline') { 98 jQuery(element+' .yrm-toggle-expand').css({"text-align": val}); 99 } 100}; 101 102YrmMore.prototype.livePreview = function() { 103 104 this.changeButtonWidth(); 105 this.changeButtonHeight(); 106 this.changeButtonFontSize(); 107 this.changeButtonFontWeight(); 108 this.changeBtnBackgroundColor(); 109 this.changeBtnTextColor(); 110 this.changeBtnBorderBottom(); 111 this.changeBorderRadius(); 112 this.changeHorizontalAligment(); 113 this.addFontFamilyOptionsView(); 114 this.changeButtonFontFamily(); 115 this.changeHiddenContentFontFamily(); 116 this.changeHoverEffect(); 117 this.changeHiddenContentBgColor(); 118 this.changeHiddenContentTextColor(); 119 this.changeHiddenContentPadding(); 120 this.changeButtonTitle(); 121}; 122 123YrmMore.prototype.changeHoverEffect = function() { 124 125 var id = this.getData('id'); 126 var buttonHoverIcon = jQuery('.yrm-eye-button-hover'); 127 if (!buttonHoverIcon.length) { 128 return; 129 } 130 var effect = function (enableClass) { 131 var button = jQuery('.yrm-toggle-expand'); 132 var classes = button.attr('data-animate'); 133 button.removeClass(classes); 134 if (enableClass) { 135 setTimeout(function () {
136 button.addClass(classes); 137 }, 0); 138 } 139 }; 140 buttonHoverIcon.bind('click', function () { 141 setTimeout(function () { 142 effect(true); 143 }, 0); 144 }); 145 jQuery('[name="yrm-btn-hover-animate"]').change(function() { 146 val = jQuery(this).val(); 147 effect(false); 148 jQuery('.yrm-toggle-expand-'+id).attr('data-animate', 'animated '+val); 149 effect(true); 150 }); 151}; 152 153YrmMore.prototype.changeButtonFontFamily = function() { 154 155 var that = this; 156 jQuery('[name="expander-font-family"]').bind("change", function() { 157 var val = jQuery(this).find('option:selected').text(); 158 var element = ".yrm-button-text-span"; 159 if (typeof that.setButyonFontFamily != "undefined") { 160 that.setButyonFontFamily(element, val); 161 } 162 }); 163}; 164 165YrmMore.prototype.changeHiddenContentFontFamily = function() { 166 167 var that = this; 168 jQuery('[name="hidden-content-font-family"]').bind("change", function() { 169 var val = jQuery(this).find('option:selected').text(); 170 var element = ".yrm-inner-content-wrapper"; 171 if (typeof that.setButyonFontFamily != "undefined") { 172 that.setButyonFontFamily(element, val); 173 } 174 }); 175}; 176 177YrmMore.prototype.addFontFamilyOptionsView = function() { 178 179 jQuery('[name="expander-font-family"]').find('option').each(function() { 180 var family = jQuery(this).text(); 181 jQuery(this).css({'font-family': family}) 182 }) 183}; 184 185YrmMore.prototype.changeButtonWidth = function() { 186 jQuery('.expm-btn-width').change(function() { 187 var width = jQuery(this).val(); 188 jQuery(".yrm-toggle-expand").css({ 189 "width": width 190 }); 191 }); 192}; 193 194YrmMore.prototype.changeButtonHeight = function() { 195 jQuery(".expm-btn-height").change(function() { 196 var height = jQuery(this).val(); 197 jQuery(".yrm-toggle-expand").css({ 198 "height": height 199 }); 200 }); 201}; 202 203YrmMore.prototype.changeButtonFontSize = function() { 204 jQuery('.expm-option-font-size').change(function() { 205 var size = jQuery(this).val(); 206 jQuery(".yrm-button-text-span").css({ 207 'font-size': size 208 }) 209 }); 210}; 211 212YrmMore.prototype.changeButtonFontWeight = function() { 213 jQuery('[name="yrm-btn-font-weight"]').change(function() { 214 var fontWeight = jQuery(this).val(); 215 jQuery(".yrm-button-text-span").css({ 216 'font-weight': fontWeight 217 }) 218 }); 219}; 220 221YrmMore.prototype.changeBtnBackgroundColor = function() { 222 var that = this; 223 if(typeof jQuery.fn.minicolors != 'undefined') { 224 jQuery('.background-color').minicolors({ 225 format: 'rgb', 226 opacity: 1, 227 change: function() { 228 var val = jQuery(this).val(); 229 var element = ".yrm-toggle-expand"; 230 that.setBackgroundColor(element, val); 231 } 232 }); 233 } 234}; 235 236YrmMore.prototype.changeBorderRadius = function() { 237 238 var that = this; 239 jQuery(".btn-border-radius").change(function() { 240 241 var value = jQuery(this).val(); 242 var element = ".yrm-toggle-expand"; 243 that.setBorderRadius(element, value); 244 }); 245}; 246 247YrmMore.prototype.changeBtnTextColor = function() { 248 var that = this; 249 if(typeof jQuery.fn.minicolors != 'undefined') { 250 jQuery(".btn-text-color").minicolors({ 251 change: function () { 252 var val = jQuery(this).val(); 253 var elemnt = ".yrm-toggle-expand"; 254 that.setTextColor(elemnt, val); 255 } 256 }); 257 jQuery(".btn-hover-color").minicolors({}); 258 } 259}; 260 261YrmMore.prototype.changeBtnBorderBottom = function() { 262 var that = this; 263 if(typeof jQuery.fn.minicolors != 'undefined') { 264 jQuery('.yrm-button-bottom-border-color').minicolors({ 265 change: function () { 266 jQuery(window).trigger('yrmChangeBorderBottom'); 267 } 268 }); 269 jQuery(".btn-hover-color").minicolors({}); 270 } 271 jQuery('[name="yrm-button-bottom-border-style"], #yrm-button-border-bottom, .yrm-button-bottom-border-width').bind('change', function () { 272 jQuery(window).trigger('yrmChangeBorderBottom'); 273 }); 274}; 275 276jQuery(window).bind('yrmChangeBorderBottom', function () { 277 var color = jQuery('.yrm-button-bottom-border-color').val(); 278 var width = jQuery('.yrm-button-bottom-border-width').val();
279 var style = jQuery('[name="yrm-button-bottom-border-style"] option:selected').val(); 280 if (!jQuery('#yrm-button-border-bottom').is(':checked')) { 281 width = '0px'; 282 } 283 284 jQuery('.yrm-button-text-span').css({'border-bottom': width+' '+style+' '+color}); 285}); 286 287YrmMore.prototype.changeHorizontalAligment = function() { 288 289 var that = this; 290 jQuery("[name='horizontal']").change(function() { 291 var val = jQuery(this).val(); 292 var element = ".expand-btn-wrappper"; 293 that.setChengHorizontalAlign(element, val); 294 }); 295}; 296 297YrmMore.prototype.changeHiddenContentBgColor = function () { 298 299 if(!jQuery('.hidden-content-bg-color').length || typeof jQuery.fn.minicolors == 'undefined') { 300 return; 301 } 302 var that = this; 303 304 jQuery('.hidden-content-bg-color').minicolors({ 305 change: function () { 306 var val = jQuery(this).val(); 307 var elemnt = ".yrm-inner-content-wrapper"; 308 that.setContentBgColor(elemnt, val); 309 } 310 }); 311}; 312 313YrmMore.prototype.changeHiddenContentPadding = function() { 314 315 var hiddenContent = jQuery('.js-hidden-content-padding'); 316 317 if(!hiddenContent) { 318 return false; 319 } 320 321 hiddenContent.bind('change', function() { 322 var padding = parseInt(jQuery(this).val())+'px'; 323 jQuery('.yrm-inner-content-wrapper').css({'padding': padding}); 324 }); 325}; 326 327YrmMore.prototype.changeHiddenContentTextColor = function () { 328 329 if(!jQuery('.hidden-content-text-color').length || typeof jQuery.fn.minicolors == 'undefined') { 330 return; 331 } 332 333 var that = this; 334 335 jQuery('.hidden-content-text-color').minicolors({ 336 change: function () { 337 var val = jQuery(this).val(); 338 var elemnt = ".yrm-inner-content-wrapper"; 339 that.setContentTextColor(elemnt, val); 340 } 341 }); 342}; 343 344YrmMore.prototype.changeButtonTitle = function() { 345 var buttonInput = jQuery('.yrm-button-title'); 346 347 if(!buttonInput.length) { 348 return false; 349 } 350 351 buttonInput.bind('input', function() { 352 var type = jQuery(this).data('type'); 353 var value = jQuery(this).val(); 354 var button = jQuery('.yrm-toggle-expand'); 355 button.data(type, value); 356 var status = jQuery('.yrm-content').data('show-status'); 357 358 if(!status && type == 'more') { 359 jQuery('.yrm-button-text-span').text(value); 360 } 361 if(status && type == 'less') { 362 jQuery('.yrm-button-text-span').text(value); 363 } 364 }); 365}; 366 367YrmMore.triggerListener = function () { 368 jQuery(window).bind('YrmClose', function (e, args) { 369 if (typeof args['currentElement'] != 'undefined') { 370 var currentWrapper = args['currentElement'].parent(); 371 var moreClassName = currentWrapper.data('custom-more-class-name'); 372 var lessClassName = currentWrapper.data('custom-less-class-name'); 373 currentWrapper.removeClass(lessClassName).addClass(moreClassName); 374 } 375 }); 376 jQuery(window).bind('YrmOpen', function (e, args) { 377 if (typeof args['currentElement'] != 'undefined') { 378 var currentWrapper = args['currentElement'].parent(); 379 var moreClassName = currentWrapper.data('custom-more-class-name'); 380 var lessClassName = currentWrapper.data('custom-less-class-name'); 381 currentWrapper.removeClass(moreClassName).addClass(lessClassName); 382 } 383 }); 384}; 385 386YrmMore.prototype.initialMutator = function (data) 387{ 388 if (!data['default-show-hidden-content']) { 389 jQuery('.yrm-content-'+this.id).removeAttr('style'); 390 jQuery('.yrm-content').addClass('yrm-hide').removeClass('yrm-content-hide'); 391 } 392}; 393 394jQuery(document).ready(function () { 395 YrmMore.triggerListener(); 396});
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.