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