1function getErrorListItems(result) { 2 var errorList = ""; 3 for (key in result.Errors) { 4 if (key != undefined) { 5 for (msg in result.Errors[key]) { 6 errorList = errorList + '<li>' + result.Errors[key][msg] + '</li>'; 7 } 8 $('#' + key).addClass('input-validation-error'); 9 } 10 } 11 return errorList; 12} 13 14$.fn.customFadeIn = function (speed, callback) { 15 $(this).fadeIn(speed, function () { 16 //if (jQuery.browser.msie) 17 // $(this).get(0).style.removeAttribute('display'); 18 if (callback != undefined) 19 callback(); 20 }); 21}; 22 23function getUrlId() { 24 var urlParts = document.URL.split('/'); 25 if (urlParts != null) { 26 var part = urlParts[urlParts.length - 1]; 27 var parsed = parseInt(part, 10); 28 if (!isNaN(parsed)) { 29 return parsed; 30 } 31 } 32 return 0; 33} 34 35// namespace: 36var BCMS = BCMS || {}; 37 38BCMS.Event = function (sender) { 39 this._sender = sender; 40 this._listeners = []; 41}; 42 43BCMS.Event.prototype = { 44 attach: function(listener) { 45 this._listeners.push(listener); 46 }, 47 notify: function(args) { 48 var index; 49 for (index = 0; index < this._listeners.length; index++) { 50 this._listeners[index](this._sender, args); 51 } 52 } 53}; 54 55 56// APIs for posting comments 57var BCMSCommentsService = function () { }; 58 59BCMSCommentsService.prototype = function () { 60 61 var _postComment = function (author, email, website, body, targetId, targetType, onsuccess, onfailure) { 62 63 author = encodeURIComponent(author); 64 email = encodeURIComponent(email); 65 website = encodeURIComponent(website); 66 body = encodeURIComponent(body); 67 68 $.ajax( 69 { 70 type: "POST", 71 url: "/comment/postComment", 72 data: "author=" + author 73 + "&email=" + email 74 + "&website= " + website 75 + "&body=" + body 76 + '&targetId=' + targetId 77 + '&targetContentType=' + targetType, 78 dataType: "json", 79 error: function (result, errortext, errorThrown) { 80 onfailure(result, errortext, errorThrown); 81 }, 82 success: function (result) { 83 onsuccess(result); 84 } 85 }); 86 }; 87 88 var _deleteComment = function (id, onsuccess, onfailure) { 89 $.ajax( 90 { 91 type: "POST", 92 url: '/api/comments/'+id+'/deletecomment', 93 error: function (result, errortext, errorThrown) { 94 onfailure(result, errortext, errorThrown); 95 }, 96 success: function (result) { 97 onsuccess(result); 98 } 99 }); 100 } 101 102 var _flagSpam = function (id, onsuccess, onfailure) { 103 $.ajax( 104 { 105 type: "POST", 106 url: "/api/comments/" + id + "/missedspam", 107 error: function (result, errortext, errorThrown) { 108 onfailure(result, errortext, errorThrown); 109 }, 110 success: function (result) { 111 onsuccess(result); 112 } 113 }); 114 } 115 116 var _unflagSpam = function (id, onsuccess, onfailure) { 117 $.ajax( 118 { 119 type: "POST", 120 url: "/api/comments/" + id + "/notspam", 121 error: function (result, errortext, errorThrown) { 122 onfailure(result, errortext, errorThrown); 123 }, 124 success: function (result) { 125 onsuccess(result); 126 } 127 }); 128 } 129 130 var _getApprovedComments = function (contentId, onsuccess, onfailure) { 131 $.ajax( 132 { 133 type: "GET", 134 url: "/api/comments/" + contentId + "/approved", 135 dataType: "json", 136 error: function (result, errortext, errorThrown) { 137 onfailure(result, errortext, errorThrown); 138 }, 139 success: function (result) { 140 onsuccess(result); 141 } 142 }); 143 } 144 145 var _getPendingComments = function (pageIndex, onsuccess, onfailure) { 146 147 if (pageIndex == undefined) { 148 pageIndex = 0; 149 } 150 151 $.ajax( 152 { 153 type: 'GET', 154 url: '/api/comments/pending/' + pageIndex, 155 dataType: 'json', 156 error: function (result, errortext, errorThrown) { 157 onfailure(result, errortext, errorThrown); 158 }, 159 success: function (result) { 160 onsuccess(result); 161 } 162 }); 163 } 164 165 var _getSpamCount = function (onsuccess, onfailure) { 166 $.ajax( 167 { 168 type: "GET", 169 url: "/api/comments/spam/count",
170 dataType: "json", 171 error: function (result, errortext, errorThrown) { 172 onfailure(result, errortext, errorThrown); 173 }, 174 success: function (result) { 175 onsuccess(result); 176 } 177 }); 178 } 179 180 181 var _approveComment = function (id, onsuccess, onfailure) { 182 $.ajax( 183 { 184 type: "POST", 185 url: "/api/comments/" + id + "/approved", 186 error: function (result, errortext, errorThrown) { 187 onfailure(result, errortext, errorThrown); 188 }, 189 success: function (result) { 190 onsuccess(result); 191 } 192 }); 193 } 194 195 var _unapproveComment = function (id, onsuccess, onfailure) { 196 $.ajax( 197 { 198 type: "POST", 199 url: "/api/comments/" + id + "/unapproved", 200 error: function (result, errortext, errorThrown) { 201 onfailure(result, errortext, errorThrown); 202 }, 203 success: function (result) { 204 onsuccess(result); 205 } 206 }); 207 } 208 209 return { 210 deleteComment: _deleteComment, 211 flagSpam: _flagSpam, 212 unflagSpam: _unflagSpam, 213 getApprovedComments: _getApprovedComments, 214 getPendingComments: _getPendingComments, 215 getSpamCount: _getSpamCount, 216 postComment: _postComment, 217 approveComment: _approveComment, 218 unapproveComment: _unapproveComment 219}; 220 221}();
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.