1 2; /* Start:"a:4:{s:4:"full";s:99:"/bitrix/templates/.default/components/bitrix/forum.topic.reviews/comments/script.js?169224727425926";s:6:"source";s:83:"/bitrix/templates/.default/components/bitrix/forum.topic.reviews/comments/script.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/ 3;(function(window){ 4 window.FTRList = function (params) { 5 this.id = 'FTRList' + params.form.id; 6 this.mess = {}; 7 this.form = params.form; 8 if (!!params["id"]) { 9 for (var ii = 0; ii < params["id"].length; ii++) { 10 this.bind(params["id"][ii]); 11 } 12 } 13 this.params = { 14 preorder: (params.preorder == "Y"), 15 pageNumber: params.pageNumber, 16 pageCount: params.pageCount 17 }; 18 BX.addCustomEvent(this.form, 'onAdd', BX.delegate(this.add, this)); 19 BX.addCustomEvent(this.form, 'onRequest', BX.delegate(function () { 20 if (typeof this.params.pageNumber != 'undefined') { 21 var pageNumberInput = BX.findChild(this.form, {attr: {name: 'pageNumber'}}); 22 if (!pageNumberInput) { 23 pageNumberInput = BX.create("input", {props: {type: "hidden", name: 'pageNumber'}}); 24 this.form.appendChild(pageNumberInput); 25 } 26 pageNumberInput.value = this.params.pageNumber; 27 } 28 if (typeof this.params.pageCount != 'undefined') { 29 var pageCountInput = BX.findChild(this.form, {attr: {name: 'pageCount'}}); 30 if (!pageCountInput) { 31 pageCountInput = BX.create("input", {props: {type: "hidden", name: 'pageCount'}}); 32 this.form.appendChild(pageCountInput); 33 } 34 pageCountInput.value = this.params.pageCount; 35 } 36 }, this)); 37 BX.addCustomEvent(this.form, 'onResponse', BX.delegate(function () { 38 var input_pageno = BX.findChild(this.form, { 'attr': { 'name': 'pageNumber' }}, true); 39 if (input_pageno) { 40 BX.remove(input_pageno); 41 } 42 }, this)); 43 }; 44 window.FTRList.prototype = { 45 add : function(id, result) 46 { 47 var 48 container = BX(this.form.id + 'container'), 49 listform, 50 post = {className: /reviews-reply-form|reviews-collapse/}, 51 msgNode = window.fTextToNode(result.message); 52 if (! container) 53 { 54 container = BX.create('div', { 55 'attrs' : { 56 'id' : this.form.id + 'container'}, 57 'props': { 58 'className': 'reviews-block-container reviews-reviews-block-container'}, 59 'children': [ 60 BX.create('div', { 61 'props': { 62 'className': 'reviews-block-outer' 63 }, 64 'children': [ 65 BX.create('div', { 66 'props': { 67 'className': 'reviews-block-inner' 68 } 69 }) 70 ] 71 }) 72 ] 73 }); 74 window.fReplaceOrInsertNode(container, null, BX.findChild(document, post, true).parentNode, post); 75 container = BX(this.form.id + 'container'); 76 } 77 listform = (container ? BX.findChild(container, {className: 'reviews-block-inner'}, true) : null); 78 if (msgNode && listform) 79 { 80 if (!!result["allMessages"]) 81 { 82 window.fReplaceOrInsertNode(msgNode, listform, BX.findChild(document, post, true).parentNode, post); 83 84 if (!!result.navigation && !!result.pageNumber) 85 { 86 var navDIV = window.fTextToNode(result.navigation), i, 87 navPlaceholders = (navDIV ? BX.findChildren(container.parentNode, { className : 'reviews-navigation-box' } , true) : null); 88 if (navDIV) 89 { 90 if (!navPlaceholders) // then add ... 91 { 92 container.parentNode.insertBefore(BX.create('div', {props:{className:"reviews-navigation-box reviews-navigation-top"}}), container); 93 var tmpDiv = container; 94 // bottom 95 do { 96 tmpDiv = tmpDiv.nextSibling; 97 } while (tmpDiv && tmpDiv.nodeType != 1); 98 var bottomPager = BX.create('div', {props:{className:"reviews-navigation-box reviews-navigation-bottom"}}); 99 if (tmpDiv) 100 container.parentNode.insertBefore( bottomPager , tmpDiv); 101 else 102 container.parentNode.appendChild(bottomPager); 103 104 navPlaceholders = BX.findChildren(container.parentNode, { className : 'reviews-navigation-box' } , true); 105 } 106 for (i = 0; i < navPlaceholders.length; i++) 107 navPlaceholders[i].innerHTML = navDIV.innerHTML; 108 } 109 110 this.params.pageNumber = result.pageNumber;
111 this.params.pageCount = result.pageCount; 112 } 113 if (result["messagesID"] && typeof result["messagesID"] == "object") 114 { 115 for (var ii = 0; ii < result["messagesID"].length; ii++) 116 { 117 if (result["messagesID"][ii] != id) 118 this.bind(result["messagesID"][ii]); 119 } 120 } 121 } 122 else if (typeof result.message != 'undefined') 123 { 124 if (this.params.preorder) 125 listform.appendChild(msgNode); 126 else 127 listform.insertBefore(msgNode, listform.firstChild); 128 } 129 window.fRunScripts(result.message); 130 this.bind(id); 131 } 132 }, 133 bind : function(id) 134 { 135 var node = BX('message' + id); 136 if (!!node) 137 { 138 this.mess['m' + id] = { 139 node : node, 140 author : { 141 id : node.getAttribute("bx-author-id"), 142 name : node.getAttribute("bx-author-name") 143 } 144 }; 145 146 var buttons = BX.findChildren(node, {tagName : "A", className : "reviews-button-small"}, true), 147 func = BX.delegate(function() { var res = BX.proxy_context; this.act(res.getAttribute("bx-act"), id); }, this), 148 func2 = BX.delegate(function(){ this.act('reply', id); }, this), 149 func3 = BX.delegate(function(){ this.act('quote', id); }, this); 150 if (!!buttons && buttons.length > 0) 151 { 152 for (var ii = 0; ii < buttons.length; ii++) 153 { 154 if (buttons[ii].getAttribute("bx-act") == "moderate" || buttons[ii].getAttribute("bx-act") == "del") 155 { 156 BX.adjust(buttons[ii], 157 { 158 events : { click : func }, 159 attrs : { 160 "bx-href" : buttons[ii].getAttribute("href"), 161 href : "javascript:void(0);" 162 } 163 } 164 ); 165 } 166 else if (!!this.form) 167 { 168 if (buttons[ii].getAttribute("bx-act") == "reply") 169 { 170 BX.bind(buttons[ii], 'click', func2); 171 } 172 else if (buttons[ii].getAttribute("bx-act") == "quote") 173 { 174 BX.bind(buttons[ii], 'mousedown', func3); 175 } 176 } 177 } 178 } 179 } 180 }, 181 act : function(act, id) 182 { 183 if (!id || !this.mess['m' + id]) { 184 BX.DoNothing(); 185 } 186 else if (act == 'quote') { 187 var selection = window.GetSelection(); 188 if (document["getSelection"]) 189 { 190 selection = selection.replace(/\r\n\r\n/gi, "_newstringhere_").replace(/\r\n/gi, " "); 191 selection = selection.replace(/ /gi, "").replace(/_newstringhere_/gi, "\r\n\r\n"); 192 } 193 194 if (selection === "" && id > 0 && BX('message_text_' + id, true)) 195 { 196 var message = BX('message_text_' + id, true); 197 if (typeof(message) == "object" && message) 198 selection = message.innerHTML; 199 } 200 201 selection = selection.replace(/[\n|\r]*<br(\s)*(\/)*>/gi, "\n"); 202 203 // Video 204 var videoWMV = function(str, p1) 205 { 206 var result = ' '; 207 var rWmv = /showWMVPlayer.*?bx_wmv_player.*?file:[\s'"]*([^"']*).*?width:[\s'"]*([^"']*).*?height:[\s'"]*([^'"]*).*?/gi; 208 var res = rWmv.exec(p1); 209 if (res) 210 result = "[VIDEO WIDTH="+res[2]+" HEIGHT="+res[3]+"]"+res[1]+"[/VIDEO]"; 211 if (result == ' ') 212 { 213 var rFlv = /bxPlayerOnload[\s\S]*?[\s'"]*file[\s'"]*:[\s'"]*([^"']*)[\s\S]*?[\s'"]*height[\s'"]*:[\s'"]*([^"']*)[\s\S]*?[\s'"]*width[\s'"]*:[\s'"]*([^"']*)/gi; 214 res = rFlv.exec(p1); 215 if (res) 216 result = "[VIDEO WIDTH="+res[3]+" HEIGHT="+res[2]+"]"+res[1]+"[/VIDEO]"; 217 } 218 return result; 219 } 220 221 selection = selection.replace(/<script[^>]*>/gi, '\001').replace(/<\/script[^>]*>/gi, '\002'); 222 selection = selection.replace(/\001([^\002]*)\002/gi, videoWMV) 223 selection = selection.replace(/<noscript[^>]*>/gi, '\003').replace(/<\/noscript[^>]*>/gi, '\004'); 224 selection = selection.replace(/\003([^\004]*)\004/gi, " "); 225 226 // Quote & Code & Table 227 selection = selection.replace(/<table class\=[\"]*forum-quote[\"]*>
227[^<]*<thead>[^<]*<tr>[^<]*<th>([^<]+)<\/th><\/tr><\/thead>[^<]*<tbody>[^<]*<tr>[^<]*<td>/gi, "\001"); 228 selection = selection.replace(/<table class\=[\"]*forum-code[\"]*>[^<]*<thead>[^<]*<tr>[^<]*<th>([^<]+)<\/th><\/tr><\/thead>[^<]*<tbody>[^<]*<tr>[^<]*<td>/gi, "\002"); 229 selection = selection.replace(/<table class\=[\"]*data-table[\"]*>[^<]*<tbody>/gi, "\004"); 230 selection = selection.replace(/<\/td>[^<]*<\/tr>(<\/tbody>)*<\/table>/gi, "\003"); 231 selection = selection.replace(/[\r|\n]{2,}([\001|\002])/gi, "\n$1"); 232 233 var ii = 0; 234 while(ii++ < 50 && (selection.search(/\002([^\002\003]*)\003/gi) >= 0 || selection.search(/\001([^\001\003]*)\003/gi) >= 0)) 235 { 236 selection = selection.replace(/\002([^\002\003]*)\003/gi, "[CODE]$1[/CODE]").replace(/\001([^\001\003]*)\003/gi, "[QUOTE]$1[/QUOTE]"); 237 } 238 239 var regexReplaceTableTag = function(s, tag, replacement) 240 { 241 var re_match = new RegExp("\004([^\004\003]*)("+tag+")([^\004\003]*)\003", "i"); 242 var re_replace = new RegExp("((?:\004)(?:[^\004\003]*))("+tag+")((?:[^\004\003]*)(?:\003))", "i"); 243 var ij = 0; 244 while((ij++ < 300) && (s.search(re_match) >= 0)) 245 s = s.replace(re_replace, "$1"+replacement+"$3"); 246 return s; 247 } 248 249 ii = 0; 250 while(ii++ < 10 && (selection.search(/\004([^\004\003]*)\003/gi) >= 0)) 251 { 252 selection = regexReplaceTableTag(selection, "<tr>", "[TR]"); 253 selection = regexReplaceTableTag(selection, "<\/tr>", "[/TR]"); 254 selection = regexReplaceTableTag(selection, "<td>", "[TD]"); 255 selection = regexReplaceTableTag(selection, "<\/td>", "[/TD]"); 256 selection = selection.replace(/\004([^\004\003]*)\003/gi, "[TABLE]$1[/TD][/TR][/TABLE]"); 257 } 258 259 // Smiles 260 if (BX.browser.IsIE()) 261 selection = selection.replace(/<img(?:(?:\s+alt\s*=\s*\"?smile([^\"\s]+)\"?)|(?:\s+\w+\s*=\s*[^\s>]*))*>/gi, "$1"); 262 else 263 selection = selection.replace(/<img.*?alt=[\"]*smile([^\"\s]+)[\"]*[^>]*>/gi, "$1"); 264 265 // Hrefs 266 selection = selection.replace(/<a[^>]+href=[\"]([^\"]+)\"[^>]+>([^<]+)<\/a>/gi, "[URL=$1]$2[/URL]"); 267 selection = selection.replace(/<a[^>]+href=[\']([^\']+)\'[^>]+>([^<]+)<\/a>/gi, "[URL=$1]$2[/URL]"); 268 selection = selection.replace(/<[^>]+>/gi, " ").replace(/</gi, "<").replace(/>/gi, ">").replace(/"/gi, "\""); 269 270 selection = selection.replace(/(smile(?=[:;8]))/g, ""); 271 272 selection = selection.replace(/\­/gi, ""); 273 selection = selection.replace(/\ /gi, " "); 274 BX.onCustomEvent(this.form, 'onQuote', [{author : this.mess['m' + id]["author"], id : id, text : selection}]); 275 } 276 else if (act == 'reply') { 277 BX.onCustomEvent(this.form, 'onReply', [{author : this.mess['m' + id]["author"], id : id}]); 278 } 279 else if (act == 'del' && (!confirm(BX.message('f_cdm')))) { 280 BX.DoNothing(); 281 } 282 else if (act == 'moderate' || act == 'del') { 283 var 284 link = BX.proxy_context, 285 href = link.getAttribute("bx-href").replace(/.AJAX_CALL=Y/g,'').replace(/.sessid=[^&]*/g, ''), 286 tbl = BX.findParent(link, {'tag' : 'table'}), 287 note = BX.create('a', {attrs: { className : 'reply-action-note'}}), 288 replyActionDone = function() { 289 BX.remove(note); 290 BX.show(link.parentNode); 291 }; 292 293 BX.hide(link.parentNode); 294 note.innerHTML = BX.message('f_wait'); 295 link.parentNode.parentNode.appendChild(note); 296 BX.ajax.loadJSON(href, 297 {AJAX_CALL : "Y", sessid : BX.bitrix_sessid()}, 298 BX.delegate(function(res) { 299 if (res.status && !!tbl) { 300 BX.onCustomEvent(window, 'onForumCommentAJAXAction', [act]); 301 if (act == 'del') { 302 var curpage = window["curpage"] || top.window.location.href; 303 BX.fx.hide(tbl, 'scroll', {time: 0.15, callback_complete: BX.delegate(function() { 304 BX.remove(tbl); 305 replyActionDone(); 306 var reviews = BX.findChild(BX(this.form.id + 'container'), {'class': 'reviews-post-table'}, true, true); 307 if ((!reviews) || (reviews.length < 1)) 308 if (this.params.pageNumber > 1) 309 BX.reload(curpage); 310 }, this)}); 311 } else { 312 var bHidden = BX.hasClass(tbl, 'reviews-post-hidden');
313 var label = (bHidden ? BX.message('f_hide') : BX.message('f_show')); 314 var tbldiv = BX.findChild(tbl, { className : 'reviews-text'}, true); 315 BX.fx.hide(tbldiv, 'fade', {time: 0.1, callback_complete: function() { 316 BX.toggleClass(tbl, 'reviews-post-hidden'); 317 link.innerHTML = label; 318 href = href.replace(new RegExp('REVIEW_ACTION='+(bHidden ? 'SHOW' : 'HIDE')), ('REVIEW_ACTION='+(bHidden ? 'HIDE' : 'SHOW'))); 319 link.setAttribute('bx-href', href); 320 BX.fx.show(tbldiv, 'fade', {time: 0.1}); 321 replyActionDone(); 322 BX.style(tbldiv, 'background-color', (bHidden ? '#FFFFFF' : '#E5F8E3')); // IE9 323 }}); 324 } 325 } else { 326 BX.addClass(note, 'error'); 327 note.innerHTML = '<span class="errortext">'+res.message+'</span>'; 328 } 329 }, this) 330 ); 331 } 332 return false; 333 } 334 }; 335 336 window.FTRForm = function(params) { 337 this.id = 'FTRForm' + params.form.id; 338 this.form = params.form; 339 this.editorName = params.editorName; 340 this.editorId = params.editorId; 341 this.editor = window[params.editorName]; 342 this.windowEvents = {}; 343 if (!this.editor) 344 { 345 this.windowEvents.LHE_OnInit = BX.delegate(function(pEditor) { if (pEditor.id == this.editorId) { this.addParsers(pEditor); this.editor = pEditor; } }, this); 346 this.windowEvents.LHE_ConstructorInited = BX.delegate(function(pEditor) { if (pEditor.id == this.editorId) { if (!this.editor) { this.addParsers(pEditor); this.editor = pEditor; } this.editor.ucInited = true; } }, this); 347 BX.addCustomEvent(window, 'LHE_OnInit', this.windowEvents.LHE_OnInit); 348 BX.addCustomEvent(window, 'LHE_ConstructorInited', this.windowEvents.LHE_ConstructorInited); 349 } else { 350 this.addParsers(this.editor); 351 } 352 this.params = { 353 messageMax : 64000 354 }; 355 356 BX.addCustomEvent(this.form, 'onQuote', BX.delegate(function(params){this.show(); this.paste(params, 'QUOTE');}, this)); 357 BX.addCustomEvent(this.form, 'onReply', BX.delegate(function(params){this.show(); this.paste(params, 'REPLY');}, this)); 358 }; 359 window.FTRForm.prototype = { 360 addParsers : function(pEditor) 361 { 362 pEditor.AddParser( 363 { 364 name: 'postuser', 365 obj: { 366 Parse: function(sName, sContent, pLEditor) 367 { 368 sContent = sContent.replace(/\[USER\s*=\s*(\d+)\]((?:\s|\S)*?)\[\/USER\]/ig, function(str, id, name) 369 { 370 id = parseInt(id); 371 name = BX.util.trim(name); 372 373 return '<span id="' + pLEditor.SetBxTag(false, {tag: "postuser", params: {value : id}}) + 374 '" style="color: #2067B0; border-bottom: 1px dashed #2067B0;">' + name + '</span>'; 375 }); 376 return sContent; 377 }, 378 UnParse: function(bxTag, pNode, pLEditor) 379 { 380 if (bxTag.tag == 'postuser') 381 { 382 var name = ''; 383 for (var i = 0; i < pNode.arNodes.length; i++) 384 name += pLEditor._RecursiveGetHTML(pNode.arNodes[i]); 385 name = BX.util.trim(name); 386 return "[USER=" + bxTag.params.value + "]" + name +"[/USER]"; 387 } 388 return ""; 389 } 390 } 391 } 392 ); 393 }, 394 validate : function(ajax_post) 395 { 396 var form = this.form, 397 errors = "", 398 MessageLength = form.REVIEW_TEXT.value.length; 399 if (form['BXFormSubmit_save']) 400 return true; // ValidateForm may be run by BX.submit one more time 401 402 if (form.TITLE && (form.TITLE.value.length < 2)) 403 errors += BX.message('no_topic_name'); 404 405 if (MessageLength < 2) 406 errors += BX.message('no_message'); 407 else if ((this.params.messageMax !== 0) && (MessageLength > this.params.messageMax)) 408 errors += BX.message('max_len').replace(/\#MAX_LENGTH\#/gi, this.params.messageMax).replace(/\#LENGTH\#/gi, MessageLength); 409 410 if (errors !== "") 411 { 412 alert(errors); 413 return false; 414 } 415 416 var btnSubmit = BX.findChild(form, {'attribute':{'name':'send_button'}}, true); 417 if (btnSubmit) { btnSubmit.disabled = true; } 418 var btnPreview = BX.findChild(form, {'attribute':{'name':'view_button'}}, true); 419 if (btnPreview) { btnPreview.disabled = true; } 420 421 if (ajax_post == 'Y') 422 { 423 BX.onCustomEvent(window, 'onBeforeForumCommentAJAXPost', [form]); 424 BX.onCustomEvent(this.form, 'onRequest', [this, ajax_post]); 425 426 setTimeout(BX.delegate(function() { BX.ajax.submit(form, BX.delegate(this.get, this)); }, this), 50); 427 return false;
428 } 429 return true; 430 }, 431 get : function() 432 { 433 this.form['BXFormSubmit_save'] = null; 434 var result = window.forumAjaxPostTmp; 435 window["curpage"] = window["curpage"] || top.window.location.href; 436 437 BX.onCustomEvent(window, 'onForumCommentAJAXPost', [result, this.form]); 438 439 if (typeof result == 'undefined' || result.reload) 440 { 441 BX.reload(window["curpage"]); 442 return; 443 } 444 445 if (result["status"]) 446 { 447 if (!!result["allMessages"] || typeof result["message"] != 'undefined') 448 { 449 BX.onCustomEvent(this.form, 'onAdd', [result["messageID"], result]); 450 this.clear(); 451 } 452 else if (!!result["previewMessage"]) 453 { 454 var previewDIV = BX.findChild(document, {'className': 'reviews-preview'}, true), 455 previewParent = BX.findChild(document, {className : /reviews-reply-form|reviews-collapse/}, true).parentNode, 456 previewNode = window.fTextToNode(result["previewMessage"]); 457 window.fReplaceOrInsertNode(previewNode, previewDIV, previewParent, {'className' : /reviews-reply-form|reviews-collapse/}); 458 459 window.PostFormAjaxStatus(''); 460 window.fRunScripts(result["previewMessage"]); 461 } 462 var message = (!!result["messageID"] ? BX('message'+result["messageID"]) : null); 463 if (message) { 464 BX.scrollToNode(message); 465 } 466 } 467 468 var arr = this.form.getElementsByTagName("input"); 469 for (var i=0; i < arr.length; i++) 470 { 471 var butt = arr[i]; 472 if (butt.getAttribute("type") == "submit") 473 butt.disabled = false; 474 } 475 476 if (result["statusMessage"]) 477 window.PostFormAjaxStatus(result["statusMessage"]); 478 479 BX.onCustomEvent(this.form, 'onResponse', [result, this.form]); 480 BX.onCustomEvent(window, 'onAfterForumCommentAJAXPost', [result, this.form]); 481 }, 482 clear : function() 483 { 484 this.editor.ReInit(''); 485 486 if (this.editor.fAutosave) 487 BX.bind(this.editor.pEditorDocument, 'keydown', 488 BX.proxy(this.editor.fAutosave.Init, this.editor.fAutosave)); 489 if (!BX.type.isDomNode(this.form)) return; 490 var previewDIV = BX.findChild(document, {'className' : 'reviews-preview'}, true); 491 if (previewDIV) 492 BX.remove(previewDIV); 493 494 var i = 0, fileDIV, fileINPUT, fileINPUT1; 495 while ((fileDIV = BX('upload_files_'+(i++)+'_' + this.form.index.value)) && !!fileDIV) 496 { 497 if ((fileINPUT = BX.findChild(fileDIV, {'tag':'input'})) && !!fileINPUT1) 498 { 499 fileINPUT1 = BX.clone(fileINPUT); 500 fileINPUT1.value = ''; 501 fileINPUT.parentNode.insertBefore(fileINPUT1, fileINPUT); 502 fileINPUT.parentNode.removeChild(fileINPUT); 503 } 504 BX.hide(fileDIV); 505 } 506 var attachLink = BX.findChild(this.form, {'className':"forum-upload-file-attach"}, true); 507 if (attachLink) 508 BX.show(attachLink); 509 var attachNote = BX.findChild(this.form, {'className':"reviews-upload-info"}, true); 510 if (attachNote) 511 BX.hide(attachNote); 512 513 var captchaIMAGE = null, 514 captchaHIDDEN = BX.findChild(this.form, {attr : {'name': 'captcha_code'}}, true), 515 captchaINPUT = BX.findChild(this.form, {attr: {'name':'captcha_word'}}, true), 516 captchaDIV = BX.findChild(this.form, {'className':'reviews-reply-field-captcha-image'}, true); 517 if (captchaDIV)
518 captchaIMAGE = BX.findChild(captchaDIV, {'tag':'img'}); 519 if (captchaHIDDEN && captchaINPUT && captchaIMAGE) 520 { 521 captchaINPUT.value = ''; 522 BX.ajax.getCaptcha(function(result) { 523 captchaHIDDEN.value = result["captcha_sid"]; 524 captchaIMAGE.src = '/bitrix/tools/captcha.php?captcha_code='+result["captcha_sid"]; 525 }); 526 } 527 }, 528 show : function() 529 { 530 BX.onCustomEvent(this.form, 'onBeforeShow', [this]); 531 BX.show(this.form.parentNode); 532 BX.scrollToNode(BX.findChild(this.form, {'attribute': { 'name' : 'send_button' }}, true)); 533 setTimeout(BX.delegate(function() { 534 this.editor.SetFocus(); 535 BX.defer(this.editor.SetFocus, this.editor)(); 536 }, this), 100); 537 BX.onCustomEvent(this.form, 'onAfterShow', [this]); 538 return false; 539 }, 540 hide : function() 541 { 542 BX.onCustomEvent(this.form, 'onBeforeHide', [this]); 543 BX.hide(this.form.parentNode); 544 BX.onCustomEvent(this.form, 'onAfterHide', [this]); 545 return false; 546 }, 547 transverse : function() 548 { 549 if (this.form.parentNode.style.display == 'none') 550 this.show(); 551 else 552 this.hide(); 553 return false; 554 }, 555 paste : function(params, tag) 556 { 557 BX.onCustomEvent(this.form, 'onPaste', [params, tag, this]); 558 var author = (!!params["author"] ? params["author"] : ''), 559 text = (!!params["text"] ? params["text"] : ''), 560 id = (!!params["id"] ? params["id"] : ''); 561 562 if (!author) 563 author = ''; 564 else if (this.editor.sEditorMode == 'code' && this.editor.bBBCode) { // BB Codes 565 if (author.id > 0) 566 author = "[USER=" + author.id + "]" + author.name + "[/USER]"; 567 else 568 author = author.name; 569 } else if (this.editor.sEditorMode == 'html') { // WYSIWYG 570 author.name = author.name.replace(/</gi, '<').replace(/>/gi, '>'); 571 if (author.id > 0) 572 author = '<span id="' + this.editor.SetBxTag(false, {'tag': "postuser", 'params': {'value' : author.id}}) + 573 '" style="color: #2067B0; border-bottom: 1px dashed #2067B0;">' + author.name + '</span>'; 574 else 575 author = '<span>' + author.name + '</span>'; 576 } 577 578 if (tag == "QUOTE") 579 { 580 if (this.editor.sEditorMode == 'code' && this.editor.bBBCode) { // BB Codes 581 this.editor.WrapWith("[QUOTE" + (id > 0 ? (" ID=" + id) : "") + "]", "[/QUOTE]", 582 (author !== '' ? ( author + BX.message("f_author") + "\n") : '') + text); 583 } else if (this.editor.sEditorMode == 'html') { // WYSIWYG 584 this.editor.InsertHTML('<blockquote class="bx-quote" id="mess' + id + '">' + 585 (author !== '' ? ( author + BX.message("f_author") + '<br/>') : '') + 586 this.editor.ParseContent(text, true) + "</blockquote><br/>"); 587 } 588 } 589 else 590 { 591 text = (!!author ? (author + ', ') : "") + this.editor.ParseContent(text, true); 592 if (this.editor.sEditorMode == 'code' && this.editor.bBBCode) { // BB Codes 593 this.editor.WrapWith("", "", text); 594 } else if (this.editor.sEditorMode == 'html') { // WYSIWYG 595 this.editor.InsertHTML(text); 596 } 597 } 598 this.editor.SetFocus(); 599 BX.defer(this.editor.SetFocus, this.editor)(); 600 } 601 }; 602 BX.ready(function() { 603 if (BX.browser.IsIE()) 604 { 605 var posts = BX.findChildren(document, {'className':'reviews-post-table'}, true), ii, all, i; 606 if (!posts) return; 607 for (ii = 0; ii < posts.length; ii++) { 608 all = posts[ii].getElementsByTagName('*'); 609 i = all.length; 610 while (i--) { 611 if (all[i].scrollWidth > all[i].offsetWidth) { 612 all[i].style['paddingBottom'] = '20px'; 613 all[i].style['overflowY'] = 'hidden'; 614 } 615 } 616 } 617 } 618 }); 619 620 window.fTextToNode = function(text) 621 { 622 var tmpdiv = BX.create('div'); 623 tmpdiv.innerHTML = text; 624 if (tmpdiv.childNodes.length > 0) 625 return tmpdiv; 626 else 627 return null; 628 }; 629 630 window.PostFormAjaxStatus = function(status) 631 { 632 var arNote = BX.findChild(document, { className : 'reviews-note-box'} , true, true), i; 633 if (arNote) 634 for (i = 0; i <= arNote.length; i++) 635 BX.remove(arNote[i]); 636 637 var msgBox = BX.findChild(document, { className : 'reviews-block-container' } , true); 638 if (!msgBox) return; 639 640 if (status.length < 1) return; 641 642 var statusDIV = window.fTextToNode(status); 643 if (!statusDIV) return; 644 645 var beforeDivs = ['reviews-reply-form', 'reviews-collapse']; 646 var tmp = msgBox; 647 while ((tmp = tmp.nextSibling) && !!tmp) 648 { 649 if (tmp.nodeType == 1) 650 { 651 var insert = false;
652 for (i = 0; i < beforeDivs.length; i++) 653 { 654 if (BX.hasClass(tmp, beforeDivs[i])) 655 { 656 insert = true; 657 break; 658 } 659 } 660 if (insert) 661 { 662 tmp.parentNode.insertBefore(statusDIV, tmp); 663 break; 664 } 665 } 666 } 667 }; 668 669 window.SetReviewsAjaxPostTmp = function(text) 670 { 671 window.forumAjaxPostTmp = text; 672 }; 673 674 window.fReplaceOrInsertNode = function(sourceNode, targetNode, parentTargetNode, beforeTargetNode) 675 { 676 var nextNode = null; 677 678 if (!BX.type.isDomNode(parentTargetNode)) return false; 679 680 if (!BX.type.isDomNode(sourceNode) && !BX.type.isArray(sourceNode) && sourceNode.length > 0) 681 if (! (sourceNode = window.fTextToNode(sourceNode))) return false; 682 683 if (BX.type.isDomNode(targetNode)) // replace 684 { 685 parentTargetNode = targetNode.parentNode; 686 nextNode = targetNode.nextSibling; 687 parentTargetNode.removeChild(targetNode); 688 } 689 690 if (!nextNode) 691 nextNode = BX.findChild(parentTargetNode, beforeTargetNode, true); 692 693 if (nextNode) 694 { 695 nextNode.parentNode.insertBefore(sourceNode, nextNode); 696 } else { 697 parentTargetNode.appendChild(sourceNode); 698 } 699 700 return true; 701 }; 702 703 window.fRunScripts = function(msg) 704 { 705 var ob = BX.processHTML(msg, true); 706 BX.ajax.processScripts(ob.SCRIPT, true); 707 }; 708 709 window.ShowLastEditReason = function(checked, div) 710 { 711 if (div) 712 { 713 if (checked) 714 div.style.display = 'block'; 715 else 716 div.style.display = 'none'; 717 } 718 }; 719 720 window.AttachFile = function(iNumber, iCount, sIndex, oObj) 721 { 722 var element = null; 723 var bFined = false; 724 iNumber = parseInt(iNumber); 725 iCount = parseInt(iCount); 726 727 document.getElementById('upload_files_info_' + sIndex).style.display = 'block'; 728 for (var ii = iNumber; ii < (iNumber + iCount); ii++) 729 { 730 element = document.getElementById('upload_files_' + ii + '_' + sIndex); 731 if (!element || typeof(element) === null) 732 break; 733 if (element.style.display == 'none') 734 { 735 bFined = true; 736 element.style.display = 'block'; 737 break; 738 } 739 } 740 var bHide = (!bFined ? true : (ii >= (iNumber + iCount - 1))); 741 if (bHide === true) 742 oObj.style.display = 'none'; 743 }; 744 745 /** 746 * @return {string} 747 */ 748 window.GetSelection = function() 749 { 750 var range, text = ''; 751 if (window.getSelection) { 752 range = window.getSelection(); 753 text = range.toString(); 754 } else if (document.selection) { 755 range = document.selection; 756 text = range.createRange().text; 757 } 758 return text; 759 } 760})(window); 761 762/* End */ 763; 764; /* Start:"a:4:{s:4:"full";
764s:101:"/bitrix/templates/.default/components/bitrix/search.tags.input/page_tags/script.min.js?16922472738053";s:6:"source";s:82:"/bitrix/templates/.default/components/bitrix/search.tags.input/page_tags/script.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/ 765var Errors={result_unval:"Error in result",result_empty:"Empty result"};function JsTc(oHandler,sParams,sParser){var t=this;t.oObj="object"==typeof oHandler?oHandler:document.getElementById("TAGS"),t.sParams=sParams,t.sExp=sParser?new RegExp("["+sParser+"]+","i"):new RegExp(","),t.oLast={str:!1,arr:!1},t.oThis={str:!1,arr:!1},t.oEl={start:!1,end:!1},t.oUnfinedWords={},t.bReady=!0,t.eFocus=!0,t.aDiv=null,t.oDiv=null,t.oActive=null,t.oPointer=[],t.oPointer_default=[],t.oPointer_this="input_field",t.oObj.onblur=function(){t.eFocus=!1},t.oObj.onfocus=function(){t.eFocus||(t.eFocus=!0,setTimeout(function(){t.CheckModif("focus")},500))},t.oLast.arr=t.oObj.value.split(t.sExp),t.oLast.str=t.oLast.arr.join(":"),setTimeout(function(){t.CheckModif("this")},500),this.CheckModif=function(e){var o=!1,r=0,n=!1,s="",i={};if(t.eFocus){if(t.bReady&&0<t.oObj.value.length&&(t.oThis.arr=t.oObj.value.split(t.sExp),t.oThis.str=t.oThis.arr.join(":"),t.oThis.str&&t.oThis.str!=t.oLast.str&&(i.position=TCJsUtils.getCursorPosition(t.oObj),0<i.position.end&&!t.sExp.test(t.oObj.value.substr(i.position.end-1,1))&&(i.arr=t.oObj.value.substr(0,i.position.end).split(t.sExp),o=t.oThis.arr[i.arr.length-1],t.oEl.start=i.position.end-i.arr[i.arr.length-1].length,t.oEl.end=t.oEl.start+o.length,t.oEl.content=o,t.oLast.arr=t.oThis.arr,t.oLast.str=t.oThis.str)),o)){for(r=2;r<=o.length;r++)if(s=o.substr(0,r),"!fined"==t.oUnfinedWords[s]){n=!0;break}n||t.Send(o)}setTimeout(function(){t.CheckModif("this")},500)}},t.Send=function(sSearch){if(!sSearch)return!1;var oError=[];t.bReady=!1,BX("wait_container")&&(BX("wait_container").innerHTML=BX.message("JS_CORE_LOADING"),BX.show(BX("wait_container"))),BX.ajax.post("/bitrix/components/bitrix/search.tags.input/search.php",{search:sSearch,params:t.sParams},function(data){var result={};t.bReady=!0;try{eval("result = "+data+";")}catch(t){oError.result_unval=t}TCJsUtils.empty(result)&&(oError.result_empty=Errors.result_empty);try{if(TCJsUtils.empty(oError)&&"object"==typeof result){if(1!=result.length||result[0].NAME!=t.oEl.content)return void t.Show(result)}else t.oUnfinedWords[t.oEl.content]="!fined"}catch(t){oError.unknown_error=t}BX("wait_container")&&BX.hide(BX("wait_container"))})},t.Show=function(e){t.Destroy(),t.oDiv=document.body.appendChild(document.createElement("DIV")),t.oDiv.id=t.oObj.id+"_div",t.oDiv.className="search-popup",t.oDiv.style.position="absolute",t.aDiv=t.Print(e);var o=TCJsUtils.GetRealPos(t.oObj);t.oDiv.style.width=parseInt(o.width)+"px",TCJsUtils.show(t.oDiv,o.left,o.bottom),TCJsUtils.addEvent(document,"click",t.CheckMouse),TCJsUtils.addEvent(document,"keydown",t.CheckKeyword)},t.Print=function(e){var o=null,r=[],n=[],s=0,i=null,a=null,l=t.oDiv.id;for(var c in e)e.hasOwnProperty(c)&&(o=e[c],(n=[]).ID=o.ID&&0<o.ID.length?o.ID:s++,n.GID=l+"_"+n.ID,n.NAME=TCJsUtils.htmlspecialcharsEx(o.NAME),n["~NAME"]=o.NAME,n.CNT=o.CNT,r[n.GID]=n,t.oPointer.push(n.GID),(i=t.oDiv.appendChild(document.createElement("DIV"))).id=n.GID,i.name=l+"_div",i.className="search-popup-row",i.onmouseover=function(){t.Init(),this.className="search-popup-row-active"},i.onmouseout=function(){t.Init(),this.className="search-popup-row"},i.onclick=function(e){t.oActive=this.id,t.Replace(),t.Destroy(),BX.PreventDefault(e)},(a=i.appendChild(document.createElement("DIV"))).id=i.id+"_NAME",a.className="search-popup-el search-popup-el-cnt",a.innerHTML=n.CNT,(a=i.appendChild(document.createElement("DIV"))).id=i.id+"_NAME",a.className="search-popup-el search-popup-el-name",a.innerHTML=n.NAME);return t.oPointer.push("input_field"),t.oPointer_default=t.oPointer,r},t.Destroy=function(){try{TCJsUtils.hide(t.oDiv),t.oDiv.parentNode.removeChild(t.oDiv)}catch(t){}t.aDiv=[],t.oPointer=[],t.oPointer_default=[],t.oPointer_this="input_field",t.bReady=!0,t.eFocus=!0,t.oActive=null,TCJsUtils.removeEvent(document,"click",t.CheckMouse),TCJsUtils.removeEvent(document,"keydown",t.CheckKeyword)},t.Replace=function(){if("string"==typeof t.oActive){var e=t.aDiv[t.oActive],o="";if("object"==typeof e){var r=document.createElement("textarea");r.innerHTML=e["~NAME"],o=r.value}for(var n=t.oEl.start;n<t.oObj.value.length&&" "==t.oObj.value.substring(n,n+1);)n++;t.oObj.value=t.oObj.value.substring(0,n)+o+t.oObj.value.substr(t.oEl.end),T
765CJsUtils.setCursorPosition(t.oObj,n+o.length)}},t.Init=function(){t.oActive=!1,t.oPointer=t.oPointer_default,t.Clear(),t.oPointer_this="input_pointer"},t.Clear=function(){var e=t.oDiv.getElementsByTagName("div");if(0<e.length&&"object"==typeof e)for(var o in e)if(e.hasOwnProperty(o)){var r=e[o];r&&"object"==typeof r&&r.name==t.oDiv.id+"_div"&&(r.className="search-popup-row")}},t.CheckMouse=function(){t.Replace(),t.Destroy()},t.CheckKeyword=function(e){e||(e=window.event);var o=null,r=null;if(37<e.keyCode&&e.keyCode<41||13==e.keyCode){switch(t.Clear(),e.keyCode){case 38:o=t.oPointer.pop(),t.oPointer_this==o&&(t.oPointer.unshift(o),o=t.oPointer.pop()),"input_field"!=o&&(t.oActive=o,"object"==typeof(r=document.getElementById(o))&&(r.className="search-popup-row-active")),t.oPointer.unshift(o);break;case 40:o=t.oPointer.shift(),t.oPointer_this==o&&(t.oPointer.push(o),o=t.oPointer.shift()),"input_field"!=o&&(t.oActive=o,"object"==typeof(r=document.getElementById(o))&&(r.className="search-popup-row-active")),t.oPointer.push(o);break;case 39:t.Replace(),t.Destroy();break;case 13:t.Replace(),t.Destroy(),TCJsUtils.IsIE()?(e.returnValue=!1,e.cancelBubble=!0):(e.preventDefault(),e.stopPropagation())}t.oPointer_this=o}else t.Destroy()}}var TCJsUtils={arEvents:[],addEvent:function(t,e,o){t.attachEvent?t.attachEvent("on"+e,o):t.addEventListener?t.addEventListener(e,o,!1):t["on"+e]=o,this.arEvents[this.arEvents.length]={element:t,event:e,fn:o}},removeEvent:function(t,e,o){t.detachEvent?t.detachEvent("on"+e,o):t.removeEventListener?t.removeEventListener(e,o,!1):t["on"+e]=null},getCursorPosition:function(t){var e={start:0,end:0};if(!t||"object"!=typeof t)return e;try{if(null!=document.selection&&null==t.selectionStart){t.focus();for(var o=document.selection.createRange(),r=o.parentElement(),n=o.getBookmark(),s=t.value,i=s,a="__"+Math.random()+"__";-1!=i.indexOf(a);)a="__"+Math.random()+"__";return!r||null==r||"textarea"!=r.type&&"text"!=r.type||(o.text=a+o.text+a,i=t.value,e.start=i.indexOf(a),i=i.replace(a,""),e.end=i.indexOf(a),t.value=s,o.moveToBookmark(n),o.select()),e}return{start:t.selectionStart,end:t.selectionEnd}}catch(t){}return e},setCursorPosition:function(t,e){if("object"!=typeof t)return!1;t.focus();try{if(null!=document.selection&&null==t.selectionStart)document.selection.createRange().select();else t.selectionStart=e,t.selectionEnd=e;return!0}catch(t){return!1}},printArray:function(t,e,o){try{var r="",n="";null==o&&(o=0),e||(e="\n");for(var s=0;s<=o;s++)n+=" ";for(var i in t)t.hasOwnProperty(i)&&("object"==typeof t[i]?r+=n+i+" = {"+e+TCJsUtils.printArray(t[i],e,o+1)+", "+e+"}"+e:r+=n+i+" = "+t[i]+"; "+e);return r}catch(t){}},empty:function(t){if(t)for(var e in t)if(t.hasOwnProperty(e))return!1;return!0},show:function(t,e,o){if("object"==typeof t){var r=parseInt(t.style.zIndex);return(r<=0||isNaN(r))&&(r=2200),t.style.zIndex=r,t.style.left=e+"px",t.style.top=o+"px",t}},hide:function(t){t&&(t.style.display="none")},GetRealPos:function(t){if(!t||!t.offsetParent)return!1;var e={},o=t.offsetParent;for(e.left=t.offsetLeft,e.top=t.offsetTop;o&&"BODY"!=o.tagName;)e.left+=o.offsetLeft,e.top+=o.offsetTop,o=o.offsetParent;return e.right=e.left+t.offsetWidth,e.bottom=e.top+t.offsetHeight,e.width=t.offsetWidth,e.height=t.offsetHeight,e},IsIE:function(){return document.attachEvent&&!TCJsUtils.IsOpera()},IsOpera:function(){return-1!=navigator.userAgent.toLowerCase().indexOf("opera")},htmlspecialcharsEx:function(t){return t.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")},htmlspecialcharsback:function(t){return t.replace(/</g,"<").replace(/>/g,">").replace(/";/g,'"').replace(/&/g,"&")}}; 766/* End */ 767;; /* /bitrix/templates/.default/components/bitrix/forum.topic.reviews/comments/script.js?169224727425926*/ 768; /* /bitrix/templates/.default/components/bitrix/search.tags.input/page_tags/script.min.js?16922472738053*/
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.