@@ -97,18 +97,18 @@ function _beautifySource(data) {
9797 var scriptStart = lines . indexOf ( '<script>' )
9898 var scriptEnd = lines . indexOf ( '</script>' , scriptStart )
9999 var strings = lines . slice ( scriptStart + 1 , scriptEnd )
100- strings = $ . map ( strings , function ( s ) {
101- return $ . trim ( s )
100+ strings = strings . map ( function ( s ) {
101+ return s . trim ( )
102102 } )
103103 /* eslint-disable no-control-regex */
104104 var obj = eval ( '(' + strings . join ( '' ) . replace ( / [ ^ \u0000 - \u007E ] / g, '' )
105105 . replace ( / ^ i n i t \( ( .* ) \) $ / , '$1' ) + ')' )
106106
107107 var result = [ ]
108- result = result . concat ( $ . map ( obj . links , _getLink ) )
108+ result = result . concat ( obj . links . map ( _getLink ) )
109109 result . push ( '' )
110110 result . push ( '<script src="https://cdn.jsdelivr.net/npm/jquery/dist/jquery.min.js"></script>' )
111- result = result . concat ( $ . map ( obj . scripts , function ( script ) {
111+ result = result . concat ( obj . scripts . map ( function ( script ) {
112112 return _getScript ( script , true )
113113 } ) )
114114 lines = result . concat ( lines . slice ( scriptEnd + 1 ) )
@@ -133,7 +133,11 @@ $(function () {
133133
134134 $ . ajax ( {
135135 type : 'GET' ,
136- url : url + '?' + $ . param ( query ) ,
136+ url : url + '?' + Object . keys ( query ) . filter ( function ( key ) {
137+ return query [ key ] !== null && query [ key ] !== undefined
138+ } ) . map ( function ( key ) {
139+ return encodeURIComponent ( key ) + '=' + encodeURIComponent ( query [ key ] )
140+ } ) . join ( '&' ) ,
137141 dataType : 'html' ,
138142 global : false ,
139143 cache : true , // (warning: setting it to false will cause a timestamp and will call the request twice)
@@ -154,7 +158,7 @@ $(function () {
154158} )
155159
156160window . init = function ( options_ ) {
157- var options = $ . extend ( {
161+ var options = Object . assign ( {
158162 title : '' ,
159163 desc : '' ,
160164 links : [ ] ,
@@ -169,7 +173,7 @@ window.init = function (options_) {
169173
170174 $ ( '.bd-title span' ) . html ( options . title )
171175 $ ( '.bd-lead' ) . html ( options . desc )
172- $ . each ( options . links , function ( i , file ) {
176+ options . links . forEach ( function ( file ) {
173177 _link ( file )
174178 } )
175179 _scripts ( options . scripts , options . callback )
0 commit comments