1(function(){ 2 if (Handlebars) { 3 Handlebars.registerHelper("tiered_price", function(price, access_groups) { 4 5 if (_$local.customer.access_groups && access_groups) { 6 for (var i in access_groups) { 7 var access_group_data = access_groups[i].split(',') 8 var access_group = {}; 9 10 // parse values 11 for (var x in access_group_data) { 12 var access_group_split = access_group_data[x].split(':'); 13 if (access_group_split[0] == 'price') { 14 access_group.price = access_group_split[1]; 15 } 16 if (access_group_split[0] == 'customer_group') { 17 access_group.customer_group = access_group_split[1]; 18 } 19 } 20 if ($.inArray(parseInt(access_group.customer_group), _$local.customer.access_groups) !== -1) { 21 return new Handlebars.SafeString(parseFloat(access_group.price < price? access_group.price: price).toFixed(2)); 22 } 23 } 24 } 25 return new Handlebars.SafeString(parseFloat(price).toFixed(2)); 26 }); 27 Handlebars.registerHelper("affirm_amount", function(product, min) { 28 var amount = product.sale > 0 && product.sale < product.price? product.sale: product.price; 29 if (amount < min) return 0.00; 30 return WSM.Util.floatToInt(amount); 31 }); 32 Handlebars.registerHelper("consoleDump", function(array, options) { 33 //console.log(array); 34 }); 35 Handlebars.registerHelper("console_log", function() { 36 //console.log(arguments); 37 }) 38 Handlebars.registerHelper("count", function(array, options) { 39 var i=0; count=0; 40 for (i in array) { 41 count++; 42 } 43 return count; 44 }); 45 Handlebars.registerHelper("math_add", function(key, distrib, options){ 46 return new Handlebars.SafeString((parseFloat(key) + parseFloat(distrib))); 47 }); 48 Handlebars.registerHelper("math_sub", function(key, distrib, options){ 49 let value = (parseFloat(key) - parseFloat(distrib)); 50 return new Handlebars.SafeString(value.toFixed(2)); 51 52 }); 53 Handlebars.registerHelper("alternate_key", function(key, distrib, options){ 54 return new Handlebars.SafeString((key % distrib)); 55 }); 56 Handlebars.registerHelper("first", function(number, documents, options) { 57 return ((documents.length) > 0 ? (parseInt(number) + 1) : 0); 58 }); 59 Handlebars.registerHelper("last", function(number, documents, options) { 60 total = documents; 61 // handles so you can pass a number or an object 62 if (typeof documents == 'object') { 63 total = documents.length; 64 } 65 if (number > 1) { 66 total += number; 67 } 68 return total; 69 }); 70 71 72 Handlebars.registerHelper("render_links", function(fields, parent, options) { 73 var out = "", a = []; 74 if (parent.tag == "search_text") { 75 for (var i in fields) { 76 a.push( '<span class="ags_sticky_link_value">' + fields[i].tag + '</span><span data-link-attr="' + fields[i].link + '" data-link-val="' + encodeURIComponent(fields[i].tag) + '" class="ags_sticky_link ags-sticky-remove">[x]</span>' ); 77 } 78 out = a.join(", "); 79 } else { 80 out_j = []; 81 for (var i in fields) { 82 a = [], line = ""; 83 var items = fields[i]; 84 line = "<span class='ags_sticky_link_label'>" + i.ucwords() + "</span><span class='ags_sticky_link_label_delimiter'>:</span>"; 85 for (var i in items) { 86 a.push( '<span class="ags_sticky_link_value">' + items[i].tag + '</span><span data-link-attr="' + items[i].link + '" data-link-val="' + encodeURIComponent(items[i].tag) + '" class="ags_sticky_link ags-sticky-remove">[x]</span>' ); 87 } 88 line += a.join(", "); 89 out_j.push(line); 90 } 91 out = out_j.join(", "); 92 } 93 return new Handlebars.SafeString(out); 94 }); 95 Handlebars.registerHelper('list', function(items, options) { 96 var out = "<ul class='widget_cat_menu'>"; 97 for (var k in items) { 98 out = out + new Handlebars.SafeString("<li><a href='#' data-value='" + encodeURIComponent(k) + "' class='filter_category'>" + k + " <span class='count'>(" + items[k] + ")</span></a></li>"); 99 } 100 out = out + "</ul>"; 101 return new Handlebars.SafeString(out); 102 }); 103 /** 104 * Generate_url 105 */ 106 Handlebars.registerHelper("generate_url", function(id, options) { 107 var _that = this; 108 if (_that.product_series_product) { 109 return "/series-" + _that.product_series + ".html"+window.location.hash; 110 } 111 return "/i-" + id; 112 }); 113 /** 114 * brand_url 115 */ 116 Handlebars.registerHelper("brand_url", function(brandName, options) { 117 if (this.brand) { 118 brandName = this.brand; 119 } 120 return brandName.trim().toLowerCase().replace(/[^a-z0-9_]+/g, '-').replace(/[^a-z0-9._:/ -]+/g, ''); 121 }); 122 /** 123 * category_url 124 */ 125 Handlebars.registerHelper("category_url", function(id, options) { 126 var _that = this; 127 if (typeof _that.value != 'undefined' && typeof _that.value.title != 'undefined') { 128 title = _that.value.title; 129 id = _that.value.id 130 } else { 131 title = _that.title; 132 id = _that.id; 133 } 134 var title = (title).trim().toLowerCase().replace(/[^a-z0-9_]+/g, '-').replace(/[^a-z0-9._:/ -]+/g, ''); 135 return '/c-'+id+'-'+title+'.html'; 136 137 }); 138 /** 139 * Generate_title 140 */ 141 Handlebars.registerHelper("generate_title", function(title, options) { 142 var _that = this; 143 if (_that.product_series_product) { 144 return new Handlebars.SafeString(_that.product_series_title); 145 } 146 return new Handlebars.SafeString(title); 147 }); 148 /**
149 * Generate quote stripped title 150 */ 151 Handlebars.registerHelper("generate_stripped_title", function(title, options) { 152 var _that = this; 153 if (_that.product_series_product) { 154 var product_series_title = (_that.product_series_title).trim().replace(/"/g,''); 155 return new Handlebars.SafeString(product_series_title); 156 } 157 return new Handlebars.SafeString(title); 158 }); 159 /** 160 * Unique_id 161 */ 162 Handlebars.registerHelper("unique_id", function(prefix, tag, options) { 163 if (typeof tag === 'object') { 164 var t = []; 165 for (var i in tag) { 166 var s = i + "-" + tag[i]; 167 t.push(s); 168 } 169 var tag = t.join("."); 170 } 171 return new Handlebars.SafeString(prefix + tag.getSumValue()); 172 }); 173 /** 174 * If Equals 175 * if_eq this compare=that 176 */ 177 Handlebars.registerHelper('if_eq', function(context, options) { 178 if (context == options.hash.compare) 179 return options.fn(this); 180 return options.inverse(this); 181 }); 182 Handlebars.registerHelper("getArrayValue", function(array) { 183 var item = ""; 184 if (typeof array == 'object' && typeof array[0] != 'undefined') { 185 var item = array[0].toString(); 186 } 187 return item; 188 }); 189 var countIndex = 0; 190 Handlebars.registerHelper("get_position", function(array){ 191 countIndex++; 192 return countIndex; 193 }); 194 Handlebars.registerHelper("format_currency", function(value) { 195 return new Handlebars.SafeString(parseFloat(value).toFixed(2)); 196 }); 197 Handlebars.registerHelper("parse_ymm_text", function(_output, _enabled, _doc, options){ 198 if (typeof _output === 'undefined') { 199 return new Handlebars.SafeString(""); 200 } 201 function capitaliseFirstLetter(string) { 202 return string.charAt(0).toUpperCase() + string.slice(1); 203 } 204 _enabled = eval(_enabled + "." + _doc); 205 _output = eval(_output + "." + _doc); 206 if (_enabled == false && _output != false) { 207 return new Handlebars.SafeString('<div id="sidebar_' + _doc + '_text" class=" wsm_widget_attribute_selector_label"><span class="wsm_widget_attribute_selector_tag">' + capitaliseFirstLetter(_doc) + ':</span><span class="wsm_widget_attribute_ymm_' + _doc + '_value">' + _output + '</span></div>'); 208 } 209 return new Handlebars.SafeString(""); 210 }); 211 Handlebars.registerHelper("is_visible", function(_obj, _ref, _options) { 212 var _val = eval(_obj + "." +_ref) || false; 213 if (_val !== false) { 214 return new Handlebars.SafeString("style='display:none'"); 215 } 216 return new Handlebars.SafeString(""); 217 }); 218 Handlebars.registerHelper("is_disabled", function(value_exists, _ref, _progressive, _facets, _defaults, options){ 219 var _force_hide = false;
220 if (typeof value_exists !== 'undefined' && typeof value_exists !== 'string') { 221 throw new Error("Arugment: 'value_exists' of Handlebars.is_disabled() is expected to be a string."); 222 } 223 if (typeof options == 'undefined') { 224 var options = _defaults; 225 var _defaults = {}; 226 } 227 if (typeof _facets === 'object') { 228 if (typeof _facets[_ref] !== 'undefined') { 229 if (((Object.keys(_facets[_ref])[0] || "")).trim().length == 0){ 230 var _key = Object.keys(_facets[_ref])[0]; 231 delete _facets[_ref][_key]; 232 value_exists = false; 233 } 234 if (Object.keys(_facets[_ref]).length == 0) { 235 _force_hide = true; 236 } 237 } 238 } 239 var _diamond = true; 240 // Backward Comp. 241 if (typeof _progressive === "object" && typeof options === "undefined") { 242 options = _progressive; 243 _progressive = false; 244 } 245 // Backward Comp. 246 if (_progressive == true) { 247 // WE check the _facets for a length result greater than 0 248 if (typeof _facets[_ref] === "object") { 249 if (Object.keys(_facets[_ref]).length == 0) { 250 value_exists = false; 251 } 252 } 253 } 254 _progressive = false; 255 if (typeof _ref !== 'undefined') { 256 var value_exists = value_exists + "." + _ref; 257 } 258 if (_force_hide == true) { 259 return new Handlebars.SafeString("style='display: none;'"); 260 } 261 if (typeof eval(value_exists) !== 'undefined' && eval(value_exists) !== false) { 262 return new Handlebars.SafeString(""); 263 } else { 264 if (_progressive == true) { 265 return new Handlebars.SafeString("style='display: none;'"); 266 } else { 267 return new Handlebars.SafeString("disabled='disabled'") 268 } 269 } 270 }); 271 Handlebars.registerHelper("default", function(exp_value, default_value){ 272 return (!exp_value) ? default_value : exp_value; 273 }); 274 Handlebars.registerHelper("get_sum_value", function(value) { 275 var that=value.toUpperCase(), t=[], i=0; 276 for(i; i < value.length; i++){ 277 t.push(that[i].toString().charCodeAt(0)); 278 } 279 return new Handlebars.SafeString(t.join(".")); 280 }); 281 Handlebars.registerHelper('arrayify',function(obj){ 282 result = []; 283 for (var key in obj) { 284 if (obj.hasOwnProperty(key)) { 285 result.push({name:key,value:obj[key]}); 286 } 287 } 288 return result; 289 }); 290 // HELPER: #key_value 291 // 292 // Usage: {{#key_value obj}} Key: {{key}} // Value: {{value}} {{/key_value}} 293 // 294 // Iterate over an object, setting 'key' and 'value' for each property in 295 // the object. 296 Handlebars.registerHelper("key_value", function(obj, dump, hbr) { 297 var buffer = "", 298 key, 299 index = 0; 300 if (typeof dump == 'object') { 301 hbr = dump; 302 } 303 if (dump === true) { 304 obj = $(document).sortNaturallyByKey(obj); 305 } 306 for (key in obj) { 307 if (obj.hasOwnProperty(key)) { 308 buffer += hbr.fn({key: key, value: obj[key], index: index}); 309 index += 1; 310 } 311 } 312 return buffer; 313 }); 314 // HELPER: #each_with_key 315 // 316 // Usage: {{#each_with_key container key="myKey"}}...{{/each_with_key}} 317 // 318 // Iterate over an object containing other objects. Each 319 // inner object will be used in turn, with an added key ("myKey") 320 // set to the value of the inner object's key in the container. 321 Handlebars.registerHelper("each_with_key", function(obj, fn) { 322 var context, 323 buffer = "", 324 key, 325 keyName = fn.hash.key; 326 327 for (key in obj) { 328 if (obj.hasOwnProperty(key)) { 329 context = obj[key]; 330 331 if (keyName) { 332 context[keyName] = key; 333 } 334 335 buffer += fn(context); 336 } 337 } 338 return buffer; 339 }); 340 Handlebars.registerHelper("parse_ymm_attribute", function(attribute, data, sort_direction, selected_default, _local_ref, options){ 341 var result = "", attribute_cap, item; 342 // We pass in a local Ref the selected_default Array 343 if (_local_ref) { 344 selected_default = selected_default + "." + _local_ref; 345 // we get String Ref. Values w/o Eval 346 sort_direction = new Function('return ' + sort_direction + "." + _local_ref)(); 347 } 348 attribute_cap = attribute.substr(0, 1).toUpperCase() + attribute.substr(1); 349 if (typeof selected_default !== 'undefined') { 350 try { 351 var value = eval(selected_default); 352 if (value !== false) { 353 result += "<option class='sticky'>" + value + "</option>"; 354 } 355 } catch (e) { 356 // we catch the error, but really just move past it so the system keeps loading 357 } 358 } 359 result += "<option >" + attribute_cap + "</option>"; 360 if (sort_direction !== false) { 361 var _data = $.extend(true, {}, data[attribute]); 362 var t = $(document).sortObjByKeys(_data, sort_direction); 363 //var t = $(document).sortByKeys(data[attribute], sort_direction); 364 for (var i in t) { 365 for (var z in t[i]) { 366 result += "<option value='" + z + "'>" + z + "</option>"; 367 } 368 } 369 } else { 370 for(item in data[attribute]){ 371 result += "<option value=" + item + ">" + item +"</option>"; 372 } 373 } 374 return new Handlebars.SafeString(result); 375 }); 376 Handlebars.registerHelper("parse_attribute", function(attribute, data, sort_direction, selected_default, options){ 377 var result = "", attribute_cap, item; 378 attribute_cap = attribute.substr(0, 1).toUpperCase() + attribute.substr(1); 379 if (typeof selected_default !== 'undefined') { 380 try { 381 var value = eval(selected_default); 382 if (value !== false) { 383 result += "<option class='sticky'>" + value + "</option>"; 384 } 385 } catch (e) { 386 // we catch the error, but really just move past it so the system keeps loading 387 } 388 } 389 result += "<option >" + attribute_cap + "</option>"; 390 if (sort_direction === true) { 391 var t = $(document).sortByKeys(data[attribute]); 392 for (var i in t) { 393 for (var z in t[i]) { 394 result += "<option value='" + z + "'>" + z + "</option>"; 395 } 396 } 397 } else { 398 for(item in data[attribute]){ 399 result += "<option value=" + item + ">" + item +"</option>"; 400 } 401 } 402 return new Handlebars.SafeString(result); 403 }); 404 405 Handlebars.registerHelper("pages_available", function(total, options){ 406 var pages = Math.ceil(parseInt(total) / parseInt(_$local.per_page)) 407 return pages; 408 }); 409 Handlebars.registerHelper("current_page", function(start, total, options){ 410 var pages = Math.ceil(parseInt(total) / parseInt(_$local.per_page))
411 var page = Math.ceil(parseInt(start) / parseInt(_$local.per_page)); 412 return ((page == 0) ? 1 : (parseInt(page) + 1)); 413 }); 414 415 Handlebars.registerHelper("show_previous_button", function(start, num_found, fn){ 416 var pages = Math.ceil(parseInt(total) / parseInt(_$local.per_page)) 417 var page = Math.ceil(parseInt(start) / parseInt(_$local.per_page)); 418 if (page > 0) { 419 return fn.fn(); 420 } 421 }); 422 423 Handlebars.registerHelper("show_pagination_links", function(start, total, options) { 424 var per_page = parseInt(_$local.per_page); 425 var min_page = 1; 426 var max_page = Math.ceil(parseInt(total) / per_page); 427 var current_page = Math.ceil(++start / per_page); 428 429 // Defaults for how we should render the pages. 430 var left_edge = 1; 431 var left_of_current = 1; 432 var right_of_current = 1; 433 var right_edge = 1; 434 435 var html = ''; 436 437 on_a_break = false; 438 for (page = min_page; page <= max_page; page++) { 439 start_record = ((page - 1) * per_page) + 1; 440 end_record = page * per_page; 441 page_num = page; 442 443 /* Always show first page */ 444 group0 = page_num == current_page; 445 /* Always show first {left_edge} page #s. */ 446 group1 = page_num <= left_edge; 447 /* Always show {left_edge + 2} pages when on the FIRST page. */ 448 group2 = current_page == min_page && page_num <= (left_edge + 2) 449 /* Always show {left_of_current} page #s to the left of the current page. */ 450 group3 = current_page - page_num >= 0 && current_page - page_num <= left_of_current; 451 /* Always show {right_of_current} page #s to the right of the current page. */ 452 group4 = current_page - page_num <= 0 && current_page - page_num >= (right_of_current * -1); 453 /* Always show last {right_edge} page #s. */ 454 group5 = page_num > (max_page - right_edge); 455 /* Always show {right_edge + 2} pages when on the LAST page. */ 456 group6 = current_page == max_page && (page_num >= (max_page - right_edge - 1)) 457 458 if (group0 || group1 || group2 || group3 || group4 || group5 || group6) { 459 if (page_num == current_page) { 460 html += '<li class="wsm-cat-pag-any"><span class="icon-pointer"><b>'+page_num+'</b></li>'; 461 } else { 462 html += '<li class="wsm-cat-pag-any"><span class="icon-pointer">'+page_num+'</span></li>'; 463 } 464 on_a_break = false; 465 } else { 466 if (!on_a_break) { 467 html += '<li class="wsm-cat-pag-any" style="cursor: default;">...</li>'; 468 on_a_break = true; 469 } 470 } 471 } 472 return new Handlebars.SafeString(html); 473 }); 474 475 Handlebars.registerHelper("view_type", function(options) { 476 var s = "wsm-prod-swap"; 477 if (_$local.view_type == "list") { 478 s = ""; 479 } 480 return new Handlebars.SafeString(s); 481 }); 482 483 Handlebars.registerHelper("view_type_current", function(options) { 484 var d = "wsm-prod-gallery-view"; 485 if (_$local.view_type == "list") { 486 d = "wsm-cat-list-view"; 487 } 488 return new Handlebars.SafeString(d); 489 }); 490 491 Handlebars.registerHelper("is_sale_price", function(sale_price, access_groups, options) { 492 var tiered_price = 0; 493 if (_$local.customer.access_groups && access_groups) { 494 for (var i in access_groups) { 495 var access_group_data = access_groups[i].split(',') 496 var access_group = {}; 497 498 // parse values 499 for (var x in access_group_data) { 500 var access_group_split = access_group_data[x].split(':'); 501 if (access_group_split[0] == 'price') { 502 access_group.price = access_group_split[1]; 503 } 504 if (access_group_split[0] == 'customer_group') { 505 access_group.customer_group = access_group_split[1]; 506 } 507 } 508 if ($.inArray(parseInt(access_group.customer_group), _$local.customer.access_groups) !== -1) { 509 tiered_price = parseFloat(access_group.price).toFixed(2); 510 } 511 } 512 } 513 514 var _that = this; 515 if (typeof _that.sale === 'undefined') { 516 return options.inverse(this); 517 } 518 if (_that.sale > 0 && _that.price > _that.sale && (tiered_price == 0 || tiered_price > 0 && tiered_price > _that.sale )) { 519 return options.fn(this); 520 } else { 521 return options.inverse(this); 522 } 523 }) 524 525 Handlebars.registerHelper("remove_smarty", function(content, options) { 526 var _that = this; 527 content = content.replace(/{{(.*)}}/g, ""); 528 return new Handlebars.SafeString(content); 529 }) 530 531 Handlebars.registerHelper("zero_inventory", function(availability, inventory){ 532 if (!inventory && availability == "Inventory") { 533 return true; 534 } else { 535 return false;
536 } 537 }); 538 Handlebars.registerHelper("is_product_available", function(availability, options){ 539 if (typeof availability === 'undefined') { 540 availability = ""; 541 } 542 var available_status = []; 543 available_status = ['available', 'unique', 'inventory', 'limited supply']; 544 if ($.inArray(availability.toString().toLowerCase(), available_status) > -1) { 545 return options.fn(this); 546 } 547 return options.inverse(this); 548 }); 549 550 Handlebars.registerHelper("get_sort_options", function(options){ 551 var items = [], x, option="", selected_option; 552 items.push({label: 'Best Match', value:'score desc, wsm_derived_priority desc, wsm_score desc'}); 553 items.push({label: 'Lowest Price', value:'price asc'}); 554 items.push({label: 'Highest Price', value:'price desc'}); 555 items.push({label: 'List A-Z', value:'title asc'}); 556 items.push({label: 'List Z-A', value:'title desc'}); 557 items.push({label: 'Newest', value:'added desc'}); 558 items.push({label: 'Oldest', value:'added asc'}); 559 // IE8 bug fix - makes us switch to for iteration 560 for (var x=0; x < items.length; x++) { 561 selected_option = ""; 562 if (items[x].value == _$local.sort_by) { 563 selected_option = "selected='selected'"; 564 } 565 option += "<option value='" + items[x].value + "'" + selected_option + ">" + items[x].label + "</option>"; 566 } 567 return new Handlebars.SafeString(option); 568 }); 569 570 Handlebars.registerHelper("get_options", function(values, options) { 571 var x, selected_option="", option=""; 572 values = JSON.parse(values); 573 selected = _$local.per_page; 574 // IE8 bug fix - makes us switch to for iteration 575 for (var x=0; x < values.length; x++) { 576 //for (x in values) { 577 selected_option = ""; 578 if (values[x] == selected) { 579 selected_option = "selected='selected'"; 580 } 581 option += "<option value='" + values[x] + "'" + selected_option + ">" + values[x] + "</option>"; 582 } 583 return new Handlebars.SafeString(option); 584 }); 585 586 Handlebars.registerHelper("camel_case", function(value, options) { 587 return (value + '').replace(/\_/g, " ").replace(/^([a-z\u00E0-\u00FC])|\s+([a-z\u00E0-\u00FC])/g, function ($1) { 588 return $1.toUpperCase(); 589 }); 590 }); 591 592 /** 593 * @note AGS Diamond (v3) Requires This 594 */ 595 Handlebars.registerHelper("not_update_only", function(key, update_only, options) { 596 if ($.inArray(key, update_only) == -1) { 597 return options.fn(this); 598 } else { 599 return options.inverse(this); 600 } 601 }); 602 603 Handlebars.registerHelper("show_more", function(index, max, _active_key, options) { 604 if (index > max) { 605 if ($.inArray(_active_key, _$local.attributes.active_show_more) > -1) { 606 return options.inverse(this); 607 } else { 608 return options.fn(this); 609 } 610 } 611 }); 612 613 Handlebars.registerHelper("show_more_options", function(data, key) { 614 // We just a local Array b/c we pass back 0's from SOLR now 615 // Just to get the list name as a full 616 var _data = []; 617 for (var i in data) { 618 if (parseInt(data[i]) > 0) { 619 _data.push(i); 620 } 621 } 622 // We're got an active class 623 if ($.inArray(key, _$local.attributes.active_show_more) > -1) { 624 return new Handlebars.SafeString("<div><a href='#' class='filter_diamond_seemore' data-group-label='" + key + "'>See Less</a></div>"); 625 } 626 if (_data.length > 10) { 627 return new Handlebars.SafeString("<div><a href='#' class='filter_diamond_seemore' data-group-label='" + key + "'>See More</a></div>"); 628 } 629 }); 630 631 /** 632 * @note AGS Diamond (v3) Requires This 633 */ 634 Handlebars.registerHelper("is_selected", function(key, value, selected, options) { 635 if (!selected) var selected = []; 636 var _key = "", _value = ""; 637 _key = (key).toString().toLowerCase(); 638 _value = (value).toString().toLowerCase(); 639 for (var i=0; i < selected.length; i++) { 640 var _sel_key = null, _sel_val = null, _sel = null; 641 _sel = Object.keys(selected[i]); 642 _sel_key = (_sel[0]).toString().toLowerCase(); 643 _sel_val = (selected[i][_sel_key]).toString().toLowerCase(); 644 if (_sel_key == _key && _sel_val == _value) { 645 return new Handlebars.SafeString("checked='checked'"); 646 } 647 } 648 }); 649 650 Handlebars.registerHelper("show_next_button", function(start, num_found, fn){
651 var page = Math.ceil(parseInt(start) / parseInt(_$local.per_page)); 652 var pages_available = Math.ceil(parseInt(num_found) / parseInt(_$local.per_page)) 653 if ((page + 1) < pages_available) { 654 return fn.fn(); 655 } 656 }); 657 658 Handlebars.registerHelper("if_cond", function(value1,operator,value2,options){ 659 switch (operator) { 660 case 'gt': 661 if (value1 > value2) { 662 return options.fn(this); 663 } 664 break; 665 } 666 }); 667 668 Handlebars.registerHelper("natural_sort", function(values, options){ 669 var _temp = $(document).sortNaturallyByKey(values); 670 values = _temp; 671 this.values = values; 672 }); 673 674 Handlebars.registerHelper("ifCond", function(value1,operator,value2,options){ 675 switch (operator) { 676 case 'gt': 677 return (parseInt(value1) > parseInt(value2)); 678 } 679 }); 680 } 681})(Handlebars)
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.