1//Infinity Scroll 2jQuery(window).ready(function () { 3 var offset = 10; 4 jQuery(document).on("click", "#load_more_testimonials", function () { 5 jQuery.ajax({ 6 url: global_ajax_url, 7 type: "POST", 8 data: { 9 action: "ajax_infinite_scroll_testimonials", 10 offset: offset 11 // security: global_admin_nonce, 12 }, 13 success:function(res) { 14 15 jQuery(".testimonial-review-main:last").after(res.data.html); 16 var final = res.data.final; 17 if(final == true){ 18 jQuery("#load_more_testimonials").hide(); 19 } 20 offset = offset + 5; 21 }, 22 error: function(errorThrown){ 23 console.log(errorThrown); 24 } 25 }); 26 }); 27 28}); 29 30//Stars JS 31jQuery(document).ready(function(){ 32 jQuery(".recommend-stars i").on( "click", function(){ 33 var rating = jQuery(this).data("star"); 34 jQuery("#recommend-stars").val(rating); 35 jQuery(".recommend-stars i").removeClass("rating-star-LR"); 36 jQuery(this).prevAll().addClass("rating-star-LR"); 37 jQuery(this).addClass("rating-star-LR"); 38 }); 39 40 jQuery(".awesomeberg-leave-a-review-button-text").click(function(){ 41 if(jQuery(this).data('submitted') == true){ 42 jQuery("#success-message-custom-testimonial").hide(); 43 jQuery(".awesomeberg-leave-a-review-form").slideToggle(1000); 44 jQuery("#review-form").fadeIn(); 45 }else{ 46 jQuery(".awesomeberg-leave-a-review-form").slideToggle(1000); 47 } 48 }); 49}); 50 51//Form JS 52jQuery(document).on("ready", function () { 53 jQuery(".testimonial-main-container .btn").click(function (event) { 54 event.preventDefault(); 55 var recommend = jQuery("#recommend-stars").val(); 56 var review = jQuery("#review-text").val(); 57 review = review.replace(/ +(?= )/g, ""); 58 var name = jQuery("#name").val(); 59 60 if (review.length == 0) { 61 jQuery("#review-text").addClass("invalid"); 62 jQuery(".required-field-text").fadeIn(); 63 return; 64 } else { 65 jQuery("#review-text").removeClass("invalid"); 66 } 67 68 if (name.length == 0) { 69 jQuery("#name").addClass("invalid"); 70 jQuery(".required-field-name").fadeIn(); 71 return; 72 } else { 73 jQuery("#review-text").removeClass("invalid"); 74 } 75 76 jQuery("#success-message-custom-testimonial").fadeIn("slow"); 77 jQuery("#review-form").hide(); 78 79 jQuery.ajax({ 80 url: global_ajax_url, 81 type: "POST", 82 data: { 83 action: "testimonial_submit", 84 security: global_frontend_nonce, 85 recommend: recommend, 86 review: review, 87 name: name, 88 }, 89 success: function (data) { 90 jQuery("#review-form").trigger("reset"); 91 jQuery(".awesomeberg-leave-a-review-button-text").data('submitted', true); 92 }, 93 error: function (errorThrown) { 94 console.log(errorThrown); 95 }, 96 }); 97 }); 98}); 99 100/*! 101 * jQuery Text Counter Plugin v0.3.5 102 * https://github.com/ractoon/jQuery-Text-Counter 103 * 104 * Copyright 2014 ractoon 105 * Released under the MIT license 106 */ 107(function ($) { 108 $.textcounter = function (el, options) { 109 // To avoid scope issues, use 'base' instead of 'this' 110 // to reference this class from internal events and functions. 111 var base = this; 112 113 // Access to jQuery and DOM versions of element 114 base.$el = jQuery(el); 115 base.el = el; 116 117 // Add a reverse reference to the DOM object 118 base.$el.data("textcounter", base); 119 120 base.init = function () { 121 base.options = $.extend({}, $.textcounter.defaultOptions, options); 122 123 // append the count element 124 var counterText = base.options.countDown 125 ? base.options.countDownText 126 : base.options.counterText, 127 counterNum = base.options.countDown ? base.options.max : 0; 128 129 base.$el.after( 130 "<" + 131 base.options.countContainerElement + 132 ' class="' + 133 base.options.countContainerClass + 134 '">' + 135 counterText + 136 '<span class="' + 137 base.options.textCountClass + 138 '">' + 139 counterNum + 140 "</span></" + 141 base.options.countContainerElement + 142 ">" 143 ); 144 145 // bind input events 146 base.$el 147 .bind( 148 "keyup.textcounter click.textcounter blur.textcounter focus.textcounter change.textcounter paste.textcounter", 149 base.checkLimits 150 ) 151 .trigger("click.textcounter"); 152 153 // TextCounter: init(el) Callback 154 base.options.init(base.el); 155 }; 156 157 base.checkLimits = function (e) { 158 var $this = base.$el, 159 $countEl = $this.nextAll("." + base.options.countContainerClass), 160 $text = $this.val(), 161 textCount = 0, 162 textTotalCount = 0, 163 eventTriggered = e.originalEvent === undefined ? false : true; 164 165 if (!$.isEmptyObject($text)) { 166 if (base.options.type == "word") { 167 // word count 168 textCount = $text.trim().replace(/\s+/gi, " ").split(" ").length; 169 } else { 170 // character count
171 if (base.options.countSpaces) { 172 // if need to count spaces 173 textCount = $text.replace(/[^\S\n|\r|\r\n]/g, " ").length; 174 } else { 175 textCount = $text.replace(/\s/g, "").length; 176 } 177 178 if (base.options.countExtendedCharacters) { 179 var extended = $text.match(/[^\x00-\xff]/gi); 180 181 if (extended == null) { 182 textCount = $text.length; 183 } else { 184 textCount = $text.length + extended.length; 185 } 186 } 187 } 188 } 189 190 // if max is auto retrieve value 191 if (base.options.max == "auto") { 192 var max = base.$el.attr("maxlength"); 193 194 if (typeof max !== "undefined" && max !== false) { 195 base.options.max = max; 196 } else { 197 base.$el 198 .nextAll("." + base.options.countContainerClass) 199 .text("error: [maxlength] attribute not set"); 200 } 201 } 202 203 // if this is a countdown counter deduct from the max characters/words 204 textTotalCount = base.options.countDown 205 ? base.options.max - textCount 206 : textCount; 207 208 // set the current text count 209 base.setCount(textTotalCount); 210 211 if (base.options.min > 0 && eventTriggered) { 212 // if a minimum value has been set 213 if (textCount < base.options.min) { 214 base.setErrors("min"); 215 } else if (textCount >= base.options.min) { 216 // TextCounter: mincount(el) Callback 217 base.options.mincount(base.el); 218 219 base.clearErrors("min"); 220 } 221 } 222 223 if (base.options.max !== -1) { 224 // if a maximum value has been set 225 if (textCount >= base.options.max && base.options.max != 0) { 226 // TextCounter: maxcount(el) Callback 227 base.options.maxcount(base.el); 228 229 if (base.options.stopInputAtMaximum) { 230 // if the string should be trimmed at the maximum length 231 var trimmedString = ""; 232 233 if (base.options.type == "word") { 234 // word type 235 var wordArray = $text.split(/[^\S\n]/g); 236 var i = 0; 237 238 // iterate over individual words 239 while (i < wordArray.length) { 240 // if over the maximum words allowed break; 241 if (i >= base.options.max - 1) break; 242 243 if (wordArray[i] !== undefined) { 244 trimmedString += wordArray[i] + " "; 245 i++; 246 } 247 } 248 } else { 249 // character type 250 if (base.options.countSpaces) { 251 // if spaces should be counted 252 trimmedString = $text.substring(0, base.options.max); 253 } else { 254 var charArray = $text.split(""), 255 totalCharacters = charArray.length, 256 charCount = 0, 257 i = 0; 258 259 while (charCount < base.options.max && i < totalCharacters) { 260 if (charArray[i] !== " ") charCount++; 261 trimmedString += charArray[i++]; 262 } 263 } 264 } 265 266 $this.val(trimmedString.trim()); 267 268 textTotalCount = base.options.countDown ? 0 : base.options.max; 269 base.setCount(textTotalCount); 270 } else { 271 base.setErrors("max"); 272 } 273 } else { 274 base.clearErrors("max"); 275 } 276 } 277 }; 278 279 base.setCount = function (count) { 280 var $this = base.$el, 281 $countEl = $this.nextAll("." + base.options.countContainerClass); 282 283 $countEl.children("." + base.options.textCountClass).text(count); 284 }; 285 286 base.setErrors = function (type) { 287 var $this = base.$el, 288 $countEl = $this.nextAll("." + base.options.countContainerClass); 289 290 $this.addClass(base.options.inputErrorClass); 291 $countEl.addClass(base.options.counterErrorClass); 292 293 if (base.options.displayErrorText) { 294 switch (type) { 295 case "min": 296 errorText = base.options.minimumErrorText; 297 break; 298 case "max": 299 errorText = base.options.maximumErrorText; 300 break; 301 } 302 303 if (!$countEl.children(".error-text-" + type).length) { 304 $countEl.append( 305 "<" + 306 base.options.errorTextElement + 307 ' class="error-text error-text-' + 308 type + 309 '">' + 310 errorText + 311 "</" + 312 base.options.errorTextElement + 313 ">" 314 ); 315 } 316 } 317 }; 318 319 base.clearErrors = function (type) { 320 var $this = base.$el, 321 $countEl = $this.nextAll("." + base.options.countContainerClass); 322 323 $countEl.children(".error-text-" + type).remove(); 324 325 if ($countEl.children(".error-text").length == 0) { 326 $this.removeClass(base.options.inputErrorClass); 327 $countEl.removeClass(base.options.counterErrorClass); 328 } 329 }; 330 331 // kick it off 332 base.init(); 333 }; 334 335 $.textcounter.defaultOptions = { 336 type: "character", // "character" or "word" 337 min: 0, // minimum number of characters/words 338 max: 200, // maximum number of characters/words, -1 for unlimited, 'auto' to use maxlength attribute 339 countContainerElement: "div", // HTML element to wrap the text count in 340 countContainerClass: "text-count-wrapper", // class applied to the countContainerElement 341 textCountClass: "text-count", // class applied to the counter length 342 inputErrorClass: "error", // error class appended to the input element if error occurs 343 counterErrorClass: "error", // error class appended to the countContainerElement if error occurs 344 counterText: "Word Count: ", // counter text 345 errorTextElement: "div", // error text element 346 minimumErrorText: "Minimum not met", // error message for minimum not met, 347 maximumErrorText: "Maximum exceeded", // error message for maximum range exceeded, 348 displayErrorText: true, // display error text messages for minimum/maximum values 349 stopInputAtMaximum: true, // stop further text input if maximum reached
350 countSpaces: false, // count spaces as character (only for "character" type) 351 countDown: false, // if the counter should deduct from maximum characters/words rather than counting up 352 countDownText: "Remaining: ", // count down text 353 countExtendedCharacters: false, // count extended UTF-8 characters as 2 bytes (such as Chinese characters) 354 355 // Callback API 356 maxcount: function (el) {}, // Callback: function(element) - Fires when the counter hits the maximum word/character count 357 mincount: function (el) {}, // Callback: function(element) - Fires when the counter hits the minimum word/character count 358 init: function (el) {}, // Callback: function(element) - Fires after the counter is initially setup 359 }; 360 361 $.fn.textcounter = function (options) { 362 return this.each(function () { 363 new $.textcounter(this, options); 364 }); 365 }; 366})(jQuery); 367 368jQuery(document).on("ready", function () { 369 jQuery("#review-text").textcounter({ 370 type: "word", 371 min: 10, 372 max: 300, 373 stopInputAtMaximum: true, 374 }); 375});
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.