Skip to content

Commit 1ecb55b

Browse files
committed
fixed no template
1 parent 4a73550 commit 1ecb55b

File tree

4 files changed

+65
-1
lines changed

4 files changed

+65
-1
lines changed

dist/article.html

+31
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,37 @@ <h3 class="footer-title">Share</h3>
211211
}).fail(itemCBs.error);
212212
});
213213
}
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+
};
214245
jQuery(function($){
215246
$("#westoredata>p a").click(function(e){
216247
e.preventDefault();

dist/index.html

+31
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,37 @@ <h3 class="footer-title">Share</h3>
198198
}).fail(itemCBs.error);
199199
});
200200
}
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+
};
201232
jQuery(function($){
202233
$("#westoredata>p a").click(function(e){
203234
e.preventDefault();

html/input/article.ejs

+2-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@
55
+ "\n"+include(htmlpath+"/parts/blogsingle.html")
66
+ "\n"+include(htmlpath+"/parts/commentlist.html");
77
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")
910
+ "\n"+include(htmlpath+"/footerjs/error.js")
1011
+ "\n"+include(htmlpath+"/footerjs/user.js")
1112
+ "\n"+include(htmlpath+"/footerjs/blogsingle.js")

html/input/index.ejs

+1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
+ "\n"+include(htmlpath+"/parts/westoredata.html")
55
+ "\n"+include(htmlpath+"/parts/bloglist.html");
66
cur_page["foot"] = include(htmlpath+"/footerjs/cacheOrLoad.js")
7+
+ "\n"+include(htmlpath+"/footerjs/template.js")
78
+ "\n"+include(htmlpath+"/footerjs/utility.js")
89
+ "\n"+include(htmlpath+"/footerjs/error.js")
910
+ "\n"+include(htmlpath+"/footerjs/user.js")

0 commit comments

Comments
 (0)