1 2/* /assets/vendor/jquery.splitlines.js */ 3/** 4 * Splits new lines of text into separate divs 5 * 6 * ### Options: 7 * - `width` string The width of the box. By default, it tries to use the 8 * element's width. If you don't define a width, there's no way to split it 9 * by lines! 10 * - `tag` string The tag to wrap the lines in 11 * - `keepHtml` boolean Whether or not to try and preserve the html within 12 * the element. Default is true 13 * 14 * @param options object The options object 15 * @license MIT License (http://www.opensource.org/licenses/mit-license.php) 16 */ 17(function($){ 18 19/** 20 * Creates a temporary clone 21 * 22 * @param element element The element to clone 23 */ 24 function _createTemp(element) { 25 return element.clone().css({position: 'absolute'}); 26 }; 27 28/** 29 * Splits contents into words, keeping their original Html tag. Note that this 30 * tags *each* word with the tag it was found in, so when the wrapping begins 31 * the tags stay intact. This may have an effect on your styles (say, if you have 32 * margin, each word will inherit those styles). 33 * 34 * @param node contents The contents 35 */ 36 function _splitHtmlWords(contents) { 37 var words = []; 38 var splitContent; 39 for (var c=0; c<contents.length; c++) { 40 if (contents[c].nodeName === 'BR') { 41 words.push('<br>'); 42 continue; 43 } 44 if (contents[c].nodeType == 3) { 45 splitContent = _splitWords(contents[c].textContent || contents[c].toString()); 46 } else { 47 var tag = $(contents[c]).clone(); 48 splitContent = _splitHtmlWords(tag.contents()); 49 for (var t=0; t<splitContent.length; t++) { 50 tag.empty(); 51 splitContent[t] = tag.html(splitContent[t]).wrap('<p></p>').parent().html(); 52 } 53 } 54 for (var w=0; w<splitContent.length; w++) { 55 if (splitContent[w] === '') { 56 continue; 57 } 58 words.push(splitContent[w]); 59 } 60 } 61 return words; 62 }; 63 64/** 65 * Splits words by spaces 66 * 67 * @param string text The text to split 68 */ 69 function _splitWords(text) { 70 return text.split(/\s+/); 71 } 72 73/** 74 * Formats html with tags and wrappers. 75 * 76 * @param tag 77 * @param html content wrapped by the tag 78 * @param index Current line index 79 */ 80 function _markupContent(tag, html, index) { 81 // wrap in a temp div so .html() gives us the tags we specify 82 tag = '<div class="stop">' + tag; 83 // find the deepest child, add html, then find the parent 84 var $outer = $(tag) 85 .find('*:not(:has("*"))') 86 .html(html) 87 .closest('.stop') 88 .slice(-1); 89 90 // jQuery does not support setting CSS vars until 3.2, so manually set them 91 $outer.children().each(function (i, element) { 92 element.style.setProperty('--line-index', index); 93 }); 94 95 return $outer.html(); 96 } 97 98/** 99 * The jQuery plugin function. See the top of this file for information on the 100 * options 101 */ 102 $.fn.splitLines = function(options) { 103 var settings = { 104 width: 'auto', 105 tag: '<div>', 106 wrap: '', 107 keepHtml: true 108 }; 109 if (options) { 110 $.extend(settings, options); 111 } 112 var newHtml = _createTemp(this); 113 var contents = this.contents(); 114 var text = this.text(); 115 this.append(newHtml); 116 newHtml.text('42'); 117 var maxHeight = newHtml.height()+2; 118 newHtml.empty(); 119 120 var tempLine = _createTemp(newHtml); 121 var width = settings.width; 122 if (settings.width === 'auto') { 123 width = this[0].offsetWidth; 124 } 125 tempLine.width(width); 126 this.append(tempLine); 127 var words = settings.keepHtml ? _splitHtmlWords(contents) : _splitWords(text); 128 var prev; 129 var lineCount = 0; 130 for (var w=0; w<words.length; w++) { 131 var html = tempLine.html(); 132 tempLine.html(html+words[w]+' '); 133 if (tempLine.html() == prev) { 134 // repeating word, it will never fit so just use it instead of failing 135 prev = ''; 136 newHtml.append(_markupContent(settings.tag, tempLine.html(), lineCount)); 137 tempLine.html(''); 138 continue; 139 } 140 if (tempLine.height() > maxHeight) { 141 prev = tempLine.html(); 142 tempLine.html(html); 143 newHtml.append(_markupContent(settings.tag, tempLine.html(), lineCount)); 144 tempLine.html(''); 145 w--; 146 lineCount++; 147 } 148 } 149 newHtml.append(_markupContent(settings.tag, tempLine.html(), lineCount)); 150 151 this.html(newHtml.html()); 152 153 }; 154})(jQuery); 155 156/* /bow/800/modules/one-page/header/template.js */ 157 158 159/* /bow/800/modules/one-page/page-header/template.js */ 160 161 162/* /bow/800/modules/one-page/counters/template.js */ 163 164 165/* /bow/800/modules/one-page/cards-swiper/template.js */ 166 167 168/* /bow/800/modules/one-page/cards-swiper-target/template.js */ 169 170 171/* /bow/800/modules/one-page/cards-swiper/template.js */ 172 173 174/* /bow/800/modules/one-page/cards-swiper/template.js */ 175 176 177/* /bow/800/modules/reviews/template.js */ 178 179 180/* /bow/800/modules/call-to-action/template.js */ 181 182 183/* /bow/800/modules/one-page/footer/template.js */ 184
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.