1/*global console, jQuery, document */ 2( function ( $ ) 3{ 4 const HideBudgetBadgeKey = 'hideBudgetBadge'; 5 $.widget( "ui.BudgetBadge", 6 { 7 options: 8 { 9 startOpened: false 10 }, 11 12 _destroy: function () 13 { 14 return undefined; 15 }, 16 17 _init: function () 18 { 19 return undefined; 20 }, 21 22 _create: function () 23 { 24 var self, jElement; 25 self = this; 26 jElement = $( self.element ); 27 28 if ( $( '#contenteditorcontainer' ).length !== 0 ) 29 { 30 return; 31 } 32 33 //jElement.prependTo( 'body' ); 34 35 const storageValue = FBUtilities.getLocalStorageObject(HideBudgetBadgeKey); 36 if ((typeof storageValue === 'undefined' || storageValue !== 'Hidden') && self.options.startOpened) 37 { 38 jElement.find( '#badgeLiner' ).hide(); 39 jElement.removeClass( 'FB_budgetLink_minimized' ); 40 self.showBudgetButton(); 41 } 42 43 $( '#FB_bbCloser' ).on('click', 44 function ( e ) 45 { 46 self.showHideBudgetButton(); 47 } 48 ).on('keypress', function ( event ) 49 { 50 const keycode = parseInt( event.keyCode ? event.keyCode : event.which ); 51 if (keycode === 13 || keycode === 32) 52 { 53 event.preventDefault(); 54 event.stopPropagation(); 55 self.showHideBudgetButton(); 56 } 57 } ); 58 }, 59 60 showHideBudgetButton: function() 61 { 62 const self = this; 63 const jElement = $( this.element ); 64 if ( jElement.outerWidth() > 50 ) 65 { 66 self.hideBudgetButton(); 67 } 68 else 69 { 70 self.showBudgetButton(); 71 } 72 }, 73 74 hideBudgetButton: function () 75 { 76 const self = this; 77 const jElement = $( this.element ); 78 79 jElement.removeClass( 'FB_budgetLink_minimized' ); 80 jElement.find( '#badgeLiner' ).animate( { 81 width: 0, 82 height: 0, 83 opacity: 0.4 84 }, { 85 duration: 1000, 86 complete: function () 87 { 88 $( '#badgeLiner' ).hide(); 89 $('#FB_bbCloser').attr('aria-expanded', 'false'); 90 jElement.addClass('FB_budgetLink_minimized'); 91 FBUtilities.setLocalStorageObject(HideBudgetBadgeKey, 'Hidden'); 92 } // end complete function 93 }); // end animate 94 }, 95 96 showBudgetButton: function () 97 { 98 var self, jElement; 99 self = this; 100 jElement = $( this.element ); 101 102 jElement.removeClass('FB_budgetLink_minimized'); 103 jElement.find( '#badgeLiner' ).width( 0 ).height( 0 ).show().animate( { 104 width: 150, 105 height: 290, 106 opacity: 1 107 }, { 108 duration: 1000, 109 complete: function () 110 { 111 $('#FB_bbCloser').attr('aria-expanded', 'true'); 112 FBUtilities.removeLocalStorageObject(HideBudgetBadgeKey); 113 114 } // end complete function 115 } 116 ); // end animate 117 } 118 } ); 119}(jQuery));
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.