File tree 4 files changed +65
-1
lines changed
4 files changed +65
-1
lines changed Original file line number Diff line number Diff line change @@ -211,6 +211,37 @@ <h3 class="footer-title">Share</h3>
211
211
} ) . fail ( itemCBs . error ) ;
212
212
} ) ;
213
213
}
214
+ function Template ( template , contain , unique ) {
215
+ this . template = Handlebars . compile ( jQuery ( template ) . html ( ) ) ;
216
+ this . contain = jQuery ( contain ) ;
217
+ this . unique = { } ;
218
+ if ( Array . isArray ( unique ) ) {
219
+ var l = unique . length ;
220
+ while ( l -- ) {
221
+ this . unique [ unique [ l ] ] = false ;
222
+ }
223
+ }
224
+ this . contain . find ( ".remove" ) . on ( "click" , this . remove . bind ( this ) ) ;
225
+ }
226
+
227
+ Template . prototype . add = function ( item ) {
228
+ if ( item . class && typeof this . unique [ item . class ] != "undefined" ) {
229
+ if ( this . unique [ item . class ] ) return ;
230
+ this . unique [ item . class ] = true ;
231
+ }
232
+ console . log ( "appending" ) ;
233
+ this . contain . append ( this . template ( item ) ) ;
234
+ } ;
235
+
236
+ Template . prototype . remove = function ( e ) {
237
+ e . preventDefault ( ) ;
238
+ var art = $ ( this ) . closest ( "article" ) ;
239
+ var u = art . attr ( "data-unique" ) ;
240
+ if ( u ) {
241
+ this . unique [ u ] = false ;
242
+ }
243
+ art . remove ( ) ;
244
+ } ;
214
245
jQuery ( function ( $ ) {
215
246
$ ( "#westoredata>p a" ) . click ( function ( e ) {
216
247
e . preventDefault ( ) ;
Original file line number Diff line number Diff line change @@ -198,6 +198,37 @@ <h3 class="footer-title">Share</h3>
198
198
} ) . fail ( itemCBs . error ) ;
199
199
} ) ;
200
200
}
201
+ function Template ( template , contain , unique ) {
202
+ this . template = Handlebars . compile ( jQuery ( template ) . html ( ) ) ;
203
+ this . contain = jQuery ( contain ) ;
204
+ this . unique = { } ;
205
+ if ( Array . isArray ( unique ) ) {
206
+ var l = unique . length ;
207
+ while ( l -- ) {
208
+ this . unique [ unique [ l ] ] = false ;
209
+ }
210
+ }
211
+ this . contain . find ( ".remove" ) . on ( "click" , this . remove . bind ( this ) ) ;
212
+ }
213
+
214
+ Template . prototype . add = function ( item ) {
215
+ if ( item . class && typeof this . unique [ item . class ] != "undefined" ) {
216
+ if ( this . unique [ item . class ] ) return ;
217
+ this . unique [ item . class ] = true ;
218
+ }
219
+ console . log ( "appending" ) ;
220
+ this . contain . append ( this . template ( item ) ) ;
221
+ } ;
222
+
223
+ Template . prototype . remove = function ( e ) {
224
+ e . preventDefault ( ) ;
225
+ var art = $ ( this ) . closest ( "article" ) ;
226
+ var u = art . attr ( "data-unique" ) ;
227
+ if ( u ) {
228
+ this . unique [ u ] = false ;
229
+ }
230
+ art . remove ( ) ;
231
+ } ;
201
232
jQuery ( function ( $ ) {
202
233
$ ( "#westoredata>p a" ) . click ( function ( e ) {
203
234
e . preventDefault ( ) ;
Original file line number Diff line number Diff line change 5
5
+ " \n " + include (htmlpath+ " /parts/blogsingle.html" )
6
6
+ " \n " + include (htmlpath+ " /parts/commentlist.html" );
7
7
cur_page[" foot" ] = include (htmlpath+ " /footerjs/cacheOrLoad.js" )
8
- + " \n " + include (htmlpath+ " /footerjs/utility.js" )
8
+ + " \n " + include (htmlpath+ " /footerjs/template.js" )
9
+ + " \n " + include (htmlpath+ " /footerjs/utility.js" )
9
10
+ " \n " + include (htmlpath+ " /footerjs/error.js" )
10
11
+ " \n " + include (htmlpath+ " /footerjs/user.js" )
11
12
+ " \n " + include (htmlpath+ " /footerjs/blogsingle.js" )
Original file line number Diff line number Diff line change 4
4
+ " \n " + include (htmlpath+ " /parts/westoredata.html" )
5
5
+ " \n " + include (htmlpath+ " /parts/bloglist.html" );
6
6
cur_page[" foot" ] = include (htmlpath+ " /footerjs/cacheOrLoad.js" )
7
+ + " \n " + include (htmlpath+ " /footerjs/template.js" )
7
8
+ " \n " + include (htmlpath+ " /footerjs/utility.js" )
8
9
+ " \n " + include (htmlpath+ " /footerjs/error.js" )
9
10
+ " \n " + include (htmlpath+ " /footerjs/user.js" )
You can’t perform that action at this time.
0 commit comments