1 2var contents = { 3 data: [], 4 types: [], 5 total: 0, 6 filter: { 7 search: "", 8 size: 500, 9 page: 1, 10 sort: "title", 11 sortType: "asc" 12 }, 13 init: function() { 14 $("*[data-explicit]").each(function(index, e) { 15 var id = $(e).data("explicit"); 16 contents.getExplicit(id); 17 }); 18 }, 19 get: function() { 20 service.call("contents", contents.filter, contents.returned); 21 }, 22 returned: function(e) { 23 $(".loader").removeClass("open"); 24 if (e.error) growler.error(e.error); 25 else { 26 contents.data = e.data; 27 contents.total = e.total; 28 context.set("contents", contents.data); 29 } 30 }, 31 isLast: function() { 32 return (contents.total <= (contents.filter.page * contents.filter.size)); 33 }, 34 isFirst: function() { 35 return contents.filter.page == 1; 36 }, 37 pageTotal: function() { 38 return Math.ceil(contents.total / contents.filter.size); 39 }, 40 goto: function(page) { 41 if (page <= contents.pageTotal() && page >= 1) { 42 contents.filter.page = page; 43 contents.get(); 44 } 45 }, 46 getExplicit: function(id) { 47 service.call("explicitcontent", {id: id}, contents.explicitReturned); 48 }, 49 explicitReturned: function(e) { 50 if (e.error) growler.error("Invalid Content"); 51 else { 52 if (e.data.length>0) { 53 $('*[data-explicit='+e.data[0].contentId+']').html(e.data[0].contents); 54 context.set("explicit"+e.data[0].contentId, e.data[0]); 55 } 56 } 57 }, 58 save: function(title, type, content, id) { 59 $(".loader").addClass("open"); 60 var params = contents.filter; 61 params.id = id; 62 params.title = title; 63 params.type = type; 64 params.contents = content; 65 service.call("contentsave", params, contents.returned); 66 }, 67 details: function(id) { 68 for (var i=0; i<contents.data.length; i++) { 69 if (id==contents.data[i].contentId) return contents.data[i]; 70 } 71 return null; 72 }, 73 getContent: function(id) { 74 service.call("content", {id: id }, contents.contentReturned); 75 }, 76 contentReturned: function(e) { 77 if (e.error) growler.error(e.error); 78 else { 79 if (e.data.length>0) { 80 context.set("content", e.data[0]); 81 $('*[data-content-title='+e.data[0].typeId+']').html(e.data[0].title); 82 $('*[data-content='+e.data[0].typeId+']').html(e.data[0].contents.split('\\n').join('')); 83 84 85 $('.accordion li').click(function() { 86 if ($(this).closest('.accordion').hasClass('one-open')) { 87 $(this).closest('.accordion').find('li').removeClass('active'); 88 $(this).addClass('active'); 89 } else { 90 $(this).toggleClass('active'); 91 } 92 if(typeof window.mr_parallax !== "undefined"){ 93 setTimeout(mr_parallax.windowLoad, 500); 94 } 95 }); 96 } 97 } 98 }, 99 getTypes: function() { 100 service.call("contentTypes", {}, contents.typesLoaded); 101 }, 102 typesLoaded: function(e) { 103 contents.types = e.data; 104 context.set("contentTypes", e.data); 105 } 106}
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.