1function showHiddenDestination(cont, el) 2{ 3 BX.hide(el); 4 BX('blog-destination-hidden-'+cont).style.display = 'inline'; 5} 6 7function showMenuLinkInput(ind, url) 8{ 9 id = 'post-menu-' + ind + '-link', 10 it = BX.proxy_context, 11 height = parseInt(!!it.getAttribute("bx-height") ? it.getAttribute("bx-height") : it.offsetHeight); 12 13 if (it.getAttribute("bx-status") != "shown") 14 { 15 it.setAttribute("bx-status", "shown"); 16 if (!BX(id) && !!BX(id + '-text')) 17 { 18 var 19 node = BX(id + '-text'), 20 pos = BX.pos(node), 21 pos2 = BX.pos(node.parentNode); 22 pos3 = BX.pos(BX.findParent(node, {'className': 'menu-popup-item'}, true)); 23 24 pos["height"] = pos2["height"] - 1; 25 26 BX.adjust(it, { 27 attrs : {"bx-height" : it.offsetHeight}, 28 style : { 29 overflow : "hidden", 30 display : 'block' 31 }, 32 children : [ 33 BX.create('BR'), 34 BX.create('DIV', { 35 attrs : {id : id}, 36 children : [ 37 BX.create('SPAN', {attrs : {"className" : "menu-popup-item-left"}}), 38 BX.create('SPAN', {attrs : {"className" : "menu-popup-item-icon"}}), 39 BX.create('SPAN', {attrs : {"className" : "menu-popup-item-text"}, 40 children : [ 41 BX.create('INPUT', { 42 attrs : { 43 id : id + '-input', 44 type : "text", 45 value : url 46 }, 47 style : { 48 height : pos["height"] + 'px', 49 width : (pos3["width"] - 21) + 'px' 50 }, 51 events : { click : function(e){ this.select(); BX.PreventDefault(e);} } 52 } 53 ) 54 ] 55 }) 56 ] 57 }), 58 BX.create('SPAN', {"className" : "menu-popup-item-right"}) 59 ] 60 }); 61 } 62 (new BX.fx({ 63 time: 0.2, 64 step: 0.05, 65 type: 'linear', 66 start: height, 67 finish: height * 2, 68 callback: BX.delegate(function(height) {this.style.height = height + 'px';}, it) 69 })).start(); 70 BX.fx.show(BX(id), 0.2); 71 BX(id + '-input').select(); 72 } 73 else 74 { 75 it.setAttribute("bx-status", "hidden"); 76 (new BX.fx({ 77 time: 0.2, 78 step: 0.05, 79 type: 'linear', 80 start: it.offsetHeight, 81 finish: height, 82 callback: BX.delegate(function(height) {this.style.height = height + 'px';}, it) 83 })).start(); 84 BX.fx.hide(BX(id), 0.2); 85 } 86} 87 88function showBlogPost(id, source) 89{ 90 var el = BX.findChild(BX('blg-post-' + id), {className: 'feed-post-text-block-inner'}, true, false); 91 el2 = BX.findChild(BX('blg-post-' + id), {className: 'feed-post-text-block-inner-inner'}, true, false); 92 BX.remove(source); 93 94 if(el) 95 { 96 var fxStart = 300; 97 var fxFinish = el2.offsetHeight; 98 (new BX.fx({ 99 time: 1.0 * (fxFinish - fxStart) / (1200-fxStart), 100 step: 0.05, 101 type: 'linear', 102 start: fxStart, 103 finish: fxFinish, 104 callback: BX.delegate(__blogExpandSetHeight, el), 105 callback_complete: BX.delegate(function() { 106 this.style.maxHeight = 'none'; 107 BX.LazyLoad.showImages(true); 108 }, el) 109 })).start(); 110 } 111} 112 113function __blogExpandSetHeight(height) 114{ 115 this.style.maxHeight = height + 'px'; 116} 117 118function deleteBlogPost(id) 119{ 120 url = BX.message('sonetBPDeletePath'); 121 url1 = url.replace('#del_post_id#', id); 122 123 if(BX.findChild(BX('blg-post-'+id), {'attr': {id: 'form_c_del'}}, true, false)) 124 { 125 BX.hide(BX('form_c_del')); 126 BX(BX('blg-post-'+id).parentNode.parentNode).appendChild(BX('form_c_del')); // Move form 127 } 128 129 BX.ajax.get(url1, function(data){ 130 if(window.deletePostEr && window.deletePostEr == "Y") 131 { 132 var el = BX('blg-post-'+id); 133 BX.findChild(el, {className: 'feed-post-cont-wrap'}, true, false).insertBefore( 134 BX.create('SPAN', { 135 html: data 136 }), 137 BX.findChild(el, {className: 'feed-user-avatar'}, true, false) 138 ); 139 } 140 else 141 { 142 BX('blg-post-'+id).parentNode.innerHTML = data; 143 } 144 }); 145 146 return false; 147} 148 149var waitPopupBlogImage = null; 150function blogShowImagePopup(src) 151{ 152 if(!waitPopupBlogImage) 153 { 154 waitPopupBlogImage = new BX.PopupWindow('blogwaitPopupBlogImage', window, { 155 autoHide: true, 156 lightShadow: false, 157 zIndex: 2, 158 content: BX.create('IMG', {props: {src: src, id: 'blgimgppp'}}), 159 closeByEsc: true, 160 closeIcon: true 161 }); 162 } 163 else 164 { 165 BX('blgimgppp').src = '/bitrix/images/1.gif'; 166 BX('blgimgppp').src = src; 167 } 168 169 waitPopupBlogImage.setOffset({ 170 offsetTop: 0, 171 offsetLeft: 0 172 }); 173 174 setTimeout(function(){waitPopupBlogImage.adjustPosition()}, 100); 175 waitPopupBlogImage.show(); 176 177} 178 179function __blogPostSetFollow(log_id) 180{ 181 var strFollowOld = (BX("log_entry_follow_" + log_id, true).getAttribute("data-follow") == "Y" ? "Y" : "N"); 182 var strFollowNew = (strFollowOld == "Y" ? "N" : "Y"); 183 184 if (BX("log_entry_follow_" + log_id, true)) 185 { 186 BX.findChild(BX("log_entry_follow_" + log_id, true), { tagName: 'a' }).innerHTML = BX.message('sonetBPFollow' + strFollowNew); 187 BX("log_entry_follow_" + log_id, true).setAttribute("data-follow", strFollowNew); 188 } 189 190 BX.ajax({ 191 url: BX.message('sonetBPSetPath'), 192 method: 'POST', 193 dataType: 'json', 194 data: { 195 "log_id": log_id, 196 "action": "change_follow", 197 "follow": strFollowNew, 198 "sessid": BX.bitrix_sessid(), 199 "site": BX.message('sonetBPSiteId') 200 }, 201 onsuccess: function(data) { 202 if ( 203 data["SUCCESS"] != "Y" 204 && BX("log_entry_follow_" + log_id, true) 205 ) 206 { 207 BX.findChild(BX("log_entry_follow_" + log_id, true), { tagName: 'a' }).innerHTML = BX.message('sonetBPFollow' + strFollowOld); 208 BX("log_entry_follow_" + log_id, true).setAttribute("data-follow", strFollowOld); 209 } 210 }, 211 onfailure: function(data) { 212 if (BX("log_entry_follow_" +log_id, true)) 213 { 214 BX.findChild(BX("log_entry_follow_" + log_id, true), { tagName: 'a' }).innerHTML = BX.message('sonetBPFollow' + strFollowOld); 215 BX("log_entry_follow_" + log_id, true).setAttribute("data-follow", strFollowOld); 216 } 217 } 218 }); 219 return false;
220} 221 222(function() { 223 if (!!window.SBPImpPost) 224 return false; 225 window.SBPImpPost = function(node) { 226 if (node.getAttribute("sbpimppost") == "Y") 227 return false; 228 this.CID = 'sbpimppost' + new Date().getTime(); 229 this.busy = false; 230 231 this.node = node; 232 this.btn = node.parentNode; 233 this.block = node.parentNode.parentNode; 234 235 this.postId = node.getAttribute("bx-blog-post-id"); 236 node.setAttribute("sbpimppost", "Y"); 237 238 BX.onCustomEvent(this.node, "onInit", [this]); 239 if (this.postId > 0) 240 this.onclick(); 241 242 return false; 243 }; 244 window.SBPImpPost.prototype.onclick = function(){ 245 this.sendData(); 246 }; 247 window.SBPImpPost.prototype.showClick = function(){ 248 var start_anim = this.btn.offsetWidth, 249 text = BX.message('BLOG_ALREADY_READ'), 250 text_block = BX.create('span',{ props:{className:'have-read-text-block'}, html:'<i></i>' + text + '<span class="feed-imp-post-footer-comma">,</span>' }); 251 252 this.block.style.minWidth = this.btn.offsetWidth-27 + 'px'; 253 254 var easing = new BX.easing({ 255 duration : 250, 256 start : { width : start_anim }, 257 finish : { width : 1 }, 258 transition : BX.easing.makeEaseOut(BX.easing.transitions.quad), 259 step : BX.delegate(function(state) { this.btn.style.width = state.width +'px' }, this), 260 complete : BX.delegate(function(){ 261 this.btn.innerHTML = ''; 262 this.btn.appendChild(text_block); 263 var width_2 = text_block.offsetWidth, 264 easing_2 = new BX.easing({ 265 duration : 300, 266 start : { width_2:0 }, 267 finish : { width_2:width_2 }, 268 transition : BX.easing.makeEaseOut(BX.easing.transitions.quad), 269 step : BX.delegate(function(state){ this.btn.style.width = state.width_2 + 'px'; }, this) 270 }); 271 easing_2.animate(); 272 }, this) 273 }); 274 easing.animate(); 275 }; 276 window.SBPImpPost.prototype.wait = function(status){ 277 status = (status == 'show' ? 'show' : 'hide'); 278 if (status == 'show') 279 { 280 this.node.disabled = true; 281 BX.adjust(this.node, {style : {position : "relative"}, 282 children : [ 283 BX.create('DIV', { 284 attrs : {className: 'mpf-load-img', "mpf-load-img" : "Y"}, 285 style : { position: "absolute", top : 0, left : 0, width: "100%" } 286 }) 287 ]}); 288 } 289 else 290 { 291 if (!!this.node.lastChild && this.node.lastChild.hasAttribute("mpf-load-img")) 292 { 293 BX.remove(this.node.lastChild); 294 } 295 } 296 }; 297 window.SBPImpPost.prototype.sendData = function(){ 298 if (this.busy) 299 return false; 300 this.busy = true; 301 window['node'] = this.node; 302 window['obj'] = this; 303 this.wait('show'); 304 var data = { 305 options : [{ post_id : this.postId, name : "BLOG_POST_IMPRTNT", value : "Y"}], 306 sessid : BX.bitrix_sessid()}, 307 url = this.node.href; 308 309 BX.onCustomEvent(this.node, "onSend", [data]); 310 data = BX.ajax.prepareData(data); 311 if (data) 312 { 313 url += (url.indexOf('?') !== -1 ? "&" : "?") + data; 314 data = ''; 315 } 316 317 BX.ajax({ 318 'method': 'GET', 319 'url': url, 320 'dataType': 'json', 321 'onsuccess': BX.delegate(function(data){ 322 this.busy = false; 323 this.wait('hide'); 324 this.showClick(); 325 BX.onCustomEvent(this.node, "onUserVote", [data]); 326 BX.onCustomEvent("onImportantPostRead", [this.postId, this.CID]); 327 }, this), 328 'onfailure': BX.delegate(function(data){ this.busy = false; this.wait('hide');}, this) 329 }); 330 }; 331 332 top.SBPImpPostCounter = function(node, postId, params) { 333 this.parentNode = node; 334 this.node = BX.findChild(node, {"tagName" : "A"}); 335 if (!this.node) 336 return false; 337 338 BX.addCustomEvent(this.node, "onUserVote", BX.delegate(function(data){this.change(data);}, this)); 339 340 this.parentNode.SBPImpPostCounter = this; 341 342 this.node.setAttribute("status", "ready"); 343 this.node.setAttribute("inumpage", 0); 344 345 this.postId = postId; 346 this.popup = null; 347 this.data = []; 348 BX.bind(node, "click", BX.proxy(function(){ this.get(); }, this)); 349 BX.bind(node, "mouseover", BX.proxy(function(e){this.init(e);}, this)); 350 BX.bind(node, "mouseout", BX.proxy(function(e){this.init(e);}, this)); 351 352 this.pathToUser = params['pathToUser']; 353 this.nameTemplate = params['nameTemplate']; 354 355 this.onPullEvent = BX.delegate(function(command, params){ 356 if (command == 'read' && !!params && params["POST_ID"] == this.postId) 357 { 358 if (!!params["data"]) 359 { 360 this.change(params["data"]); 361 } 362 } 363 }, this); 364 BX.addCustomEvent("onPullEvent-socialnetwork", this.onPullEvent); 365 }; 366 top.SBPImpPostCounter.prototype.click = function(obj) {
367 obj.uController = this; 368 BX.addCustomEvent(obj.node, "onUserVote", BX.proxy(this.change, this)); 369 BX.addCustomEvent(obj.node, "onSend", BX.proxy(function(data){ 370 data["PATH_TO_USER"] = this.pathToUser; 371 data["NAME_TEMPLATE"] = this.nameTemplate; 372 data["iNumPage"] = 0; 373 data["ID"] = this.postId; 374 data["post_id"] = this.postId; 375 data["name"] = "BLOG_POST_IMPRTNT"; 376 data["value"] = "Y"; 377 data["return"] = "users"; 378 }, this)); 379 this.btnObj = obj; 380 }; 381 382 top.SBPImpPostCounter.prototype.change = function(data) { 383 if (!!data && !!data.items) 384 { 385 var res = false; 386 this.data = []; 387 for (var ii in data.items) 388 { 389 if (data.items.hasOwnProperty(ii)) 390 { 391 this.data.push(data.items[ii]); 392 } 393 } 394 if (data["StatusPage"] == "done") 395 this.node.setAttribute("inumpage", "done"); 396 else 397 this.node.setAttribute("inumpage", 1); 398 BX.adjust(this.parentNode, {style : {display : "inline-block"}}); 399 } 400 else 401 { 402 this.node.setAttribute("inumpage", "done"); 403 BX.hide(this.parentNode); 404 } 405 this.node.firstChild.innerHTML = data["RecordCount"]; 406 }; 407 top.SBPImpPostCounter.prototype.init = function(e) { 408 if (!!this.node.timeoutOver){ 409 clearTimeout(this.node.timeoutOver); 410 this.node.timeoutOver = false; 411 } 412 if (e.type == 'mouseover'){ 413 if (!this.node.mouseoverFunc) { 414 this.node.mouseoverFunc = BX.delegate(function(){ 415 this.get(); 416 if (this.popup){ 417 BX.bind( 418 this.popup.popupContainer, 419 'mouseout', 420 BX.proxy( 421 function() 422 { 423 this.popup.timeoutOut = setTimeout( 424 BX.proxy( 425 function() 426 { 427 if (!!this.popup) { 428 this.popup.close(); 429 } 430 }, this), 431 400 432 ); 433 }, 434 this 435 ) 436 ); 437 BX.bind( 438 this.popup.popupContainer, 439 'mouseover' , 440 BX.proxy( 441 function() 442 { 443 if (this.popup.timeoutOut) 444 clearTimeout(this.popup.timeoutOut); 445 }, 446 this 447 ) 448 ); 449 } 450 }, this) 451 } 452 this.node.timeoutOver = setTimeout(this.node.mouseoverFunc, 400); 453 } 454 }; 455 456 top.SBPImpPostCounter.prototype.get = function() { 457 if (this.node.getAttribute("inumpage") != "done") 458 this.node.setAttribute("inumpage", (parseInt(this.node.getAttribute("inumpage")) + 1)); 459 this.show(); 460 if (this.data.length > 0) { 461 this.make((this.node.getAttribute("inumpage") != "done")); 462 } 463 464 if (this.node.getAttribute("inumpage") != "done") { 465 this.node.setAttribute("status", "busy"); 466 BX.ajax({ 467 url: "/bitrix/components/bitrix/socialnetwork.blog.blog/users.php", 468 method: 'POST', 469 dataType: 'json', 470 data: { 471 'ID' : this.postId, 472 'post_id' : this.postId, 473 'name' : "BLOG_POST_IMPRTNT", 474 'value' : "Y", 475 'iNumPage' : this.node.getAttribute("inumpage"), 476 'PATH_TO_USER' : this.pathToUser, 477 'NAME_TEMPLATE' : this.nameTemplate, 478 'sessid': BX.bitrix_sessid() 479 }, 480 onsuccess: BX.proxy(function(data){ 481 if (!!data && !!data.items) 482 { 483 var res = false; 484 for (var ii in data.items) { 485 this.data.push(data.items[ii]); 486 } 487 if (data.StatusPage == "done") 488 this.node.setAttribute("inumpage", "done"); 489 490 this.make((this.node.getAttribute("inumpage") != "done")); 491 } 492 else 493 { 494 this.node.setAttribute("inumpage", "done"); 495 } 496 this.node.firstChild.innerHTML = data["RecordCount"]; 497 this.node.setAttribute("status", "ready"); 498 }, this), 499 onfailure: BX.proxy(function(data){ this.node.setAttribute("status", "ready"); }, this) 500 }); 501 } 502 }; 503 top.SBPImpPostCounter.prototype.show = function() 504 { 505 if (this.popup != null) 506 this.popup.close(); 507 508 if (this.popup == null) 509 { 510 this.popup = new BX.PopupWindow('bx-vote-popup-cont-' + this.postId, this.node, { 511 lightShadow : true, 512 offsetTop: -2, 513 offsetLeft: 3, 514 autoHide: true, 515 closeByEsc: true, 516 bindOptions: {position: "top"}, 517 events : { 518 onPopupClose : function() { this.destroy() }, 519 onPopupDestroy : BX.proxy(function() { this.popup = null; }, this) 520 }, 521 content : BX.create("SPAN", { props: {className: "bx-ilike-wait"}}) 522 }); 523 524 this.popup.isNew = true; 525 this.popup.show(); 526 } 527 this.popup.setAngle({position:'bottom'}); 528 529 this.popup.bindOptions.forceBindPosition = true; 530 this.popup.adjustPosition(); 531 this.popup.bindOptions.forceBindPosition = false;
532 }; 533 top.SBPImpPostCounter.prototype.make = function(needToCheckData) 534 { 535 if (!this.popup) 536 return true; 537 needToCheckData = (needToCheckData !== false); 538 539 var 540 res1 = (this.popup && this.popup.contentContainer ? this.popup.contentContainer : BX('popup-window-content-bx-vote-popup-cont-' + this.postId)), 541 node = false, res = false, data = this.data; 542 if (this.popup.isNew) 543 { 544 node = BX.create("SPAN", { 545 props : {className : "bx-ilike-popup"}, 546 children : [ 547 BX.create("SPAN", { 548 props : {className: "bx-ilike-bottom_scroll"} 549 }) 550 ] 551 } 552 ); 553 res = BX.create("SPAN", { 554 props : {className : "bx-ilike-wrap-block"}, 555 children : [ 556 node 557 ] 558 }); 559 } 560 else 561 { 562 node = BX.findChild(this.popup.contentContainer, {className : "bx-ilike-popup"}, true); 563 } 564 if (!!node) 565 { 566 var avatarNode = null; 567 568 for (var i in data) 569 { 570 if (data.hasOwnProperty(i)) 571 { 572 if (!BX.findChild(node, {tag : "A", attr : {id : ("u" + data[i]['ID'])}}, true)) 573 { 574 if (data[i]['PHOTO_SRC'].length > 0) 575 { 576 avatarNode = BX.create("IMG", { 577 attrs: {src: data[i]['PHOTO_SRC']}, 578 props: {className: "bx-ilike-popup-avatar-img"} 579 }); 580 } 581 else 582 { 583 avatarNode = BX.create("IMG", { 584 attrs: {src: '/bitrix/images/main/blank.gif'}, 585 props: {className: "bx-ilike-popup-avatar-img bx-ilike-popup-avatar-img-default"} 586 }); 587 } 588 589 node.appendChild( 590 BX.create("A", { 591 attrs : { 592 id : ("u" + data[i]['ID']) 593 }, 594 props: { 595 href:data[i]['URL'], 596 target: "_blank", 597 className: "bx-ilike-popup-img" + (!!data[i]['TYPE'] ? " bx-ilike-popup-img-" + data[i]['TYPE'] : "") 598 }, 599 text: "", 600 children: [ 601 BX.create("SPAN", { 602 props: {className: "bx-ilike-popup-avatar-new"}, 603 children: [ 604 avatarNode, 605 BX.create("SPAN", { 606 props: {className: "bx-ilike-popup-avatar-status-icon"} 607 }) 608 ] 609 } 610 ), 611 BX.create("SPAN", { 612 props: {className: "bx-ilike-popup-name-new"}, 613 html : data[i]['FULL_NAME'] 614 } 615 ) 616 ] 617 }) 618 ); 619 } 620 } 621 } 622 if (needToCheckData) 623 { 624 BX.bind(node, 'scroll' , BX.delegate(this.popupScrollCheck, this)); 625 } 626 } 627 if (this.popup.isNew) 628 { 629 this.popup.isNew = false; 630 if (!!res1) 631 { 632 try{ 633 res1.removeChild(res1.firstChild); 634 } catch(e) {} 635 res1.appendChild(res); 636 } 637 } 638 if (this.popup != null) 639 { 640 this.popup.bindOptions.forceBindPosition = true; 641 this.popup.adjustPosition(); 642 this.popup.bindOptions.forceBindPosition = false; 643 } 644 }; 645 646 top.SBPImpPostCounter.prototype.popupScrollCheck = function() 647 { 648 var res = BX.proxy_context; 649 if (res.scrollTop > (res.scrollHeight - res.offsetHeight) / 1.5) 650 { 651 BX.unbind(res, 'scroll' , BX.delegate(this.popupScrollCheck, this)); 652 this.get(); 653 } 654 } 655})(window); 656 657window.BXfpdPostSelectCallback = function(item, type, search) 658{ 659 BX.SocNetLogDestination.BXfpSelectCallback({ 660 item: item, 661 type: type, 662 bUndeleted: false, 663 containerInput: BX('feed-add-post-destination-item-post'), 664 valueInput: BX('feed-add-post-destination-input-post'), 665 formName: BXSocNetLogDestinationFormNamePost, 666 tagInputName: 'bx-destination-tag-post', 667 tagLink1: BX.message('BX_FPD_LINK_1'), 668 tagLink2: BX.message('BX_FPD_LINK_2') 669 }); 670}; 671 672window.BXfpdPostClear = function() 673{ 674 var elements = BX.findChildren(BX('feed-add-post-destination-item-post'), {className : 'feed-add-post-destination'}, true); 675 if (elements != null) 676 { 677 for (var j = 0; j < elements.length; j++) 678 { 679 BX.remove(elements[j]); 680 } 681 } 682 BX('feed-add-post-destination-input-post').value = ''; 683 684 BX.SocNetLogDestination.BXfpSetLinkName({ 685 formName: window.BXSocNetLogDestinationFormNamePost, 686 tagInputName: 'bx-destination-tag-post', 687 tagLink1: BX.message('BX_FPD_LINK_1'), 688 tagLink2: BX.message('BX_FPD_LINK_2') 689 }); 690}; 691 692window.showSharing = function(postId, userId) 693{ 694 BXfpdPostClear(); 695 BX('sharePostId').value = postId; 696 BX('shareUserId').value = userId; 697 698 BX.SocNetLogDestination.obItemsSelected[BXSocNetLogDestinationFormNamePost] = {}; 699 if(window["postDest"+postId]) 700 { 701 for (var i = 0; i < window["postDest"+postId].length; i++) 702 { 703 if(BX.SocNetLogDestination.obItemsSelected[BXSocNetLogDestinationFormNamePost]) 704 { 705 BX.SocNetLogDestination.obItemsSelected[BXSocNetLogDestinationFormNamePost][window["postDest"+postId][i].id] = window["postDest"+postId][i].type; 706 } 707 708 if(!BX.SocNetLogDestination.obItems[BXSocNetLogDestinationFormNamePost][window["postDest"+postId][i].type][window["postDest"+postId][i].id]) 709 { 710 BX.SocNetLogDestination.obItems[BXSocNetLogDestinationFormNamePost][window["postDest"+postId][i].type][window["postDest"+postId][i].id] = {
711 avatar: '', entityId: window["postDest"+postId][i].entityId, id: window["postDest"+postId][i].id, name: window["postDest"+postId][i].name 712 }; 713 } 714 } 715 716 if(BXSocNetLogDestinationFormNamePost) 717 BX.SocNetLogDestination.reInit(BXSocNetLogDestinationFormNamePost); 718 719 var elements = BX.findChildren(BX('feed-add-post-destination-item-post'), {className : 'feed-add-post-destination'}, true); 720 if (elements != null) 721 { 722 for (var j = 0; j < elements.length; j++) 723 { 724 BX.addClass(elements[j], 'feed-add-post-destination-undelete'); 725 BX.remove(elements[j].lastChild); 726 } 727 } 728 729 var destForm = BX('destination-sharing'); 730 731 if (BX('blg-post-destcont-'+postId)) 732 { 733 BX('blg-post-destcont-'+postId).appendChild(destForm); 734 } 735 736 destForm.style.height = 0; 737 destForm.style.opacity = 0; 738 destForm.style.overflow = 'hidden'; 739 destForm.style.display = 'inline-block'; 740 741 (new BX.easing({ 742 duration : 500, 743 start : { opacity : 0, height : 0}, 744 finish : { opacity: 100, height : destForm.scrollHeight-40}, 745 transition : BX.easing.makeEaseOut(BX.easing.transitions.quad), 746 step : function(state){ 747 destForm.style.height = state.height + "px"; 748 destForm.style.opacity = state.opacity / 100; 749 }, 750 complete : function(){ 751 destForm.style.cssText = ''; 752 BX.SocNetLogDestination.openDialog(BXSocNetLogDestinationFormNamePost); 753 } 754 })).animate(); 755 } 756}; 757 758window.closeSharing = function() 759{ 760 var destForm = BX('destination-sharing'); 761 762 if (BX('sharePostSubmitButton')) 763 { 764 BX.removeClass(BX('sharePostSubmitButton'), 'feed-add-button-load'); 765 } 766 767 (new BX.easing({ 768 duration : 500, 769 start : { opacity: 100, height : destForm.scrollHeight-40}, 770 finish : { opacity : 0, height : 0}, 771 transition : BX.easing.makeEaseOut(BX.easing.transitions.quad), 772 step : function(state){ 773 destForm.style.height = state.height + "px"; 774 destForm.style.opacity = state.opacity / 100; 775 }, 776 complete : function(){ 777 BX.hide(destForm); 778 } 779 })).animate(); 780}; 781 782window.sharingPost = function() 783{ 784 var postId = BX('sharePostId').value; 785 var userId = BX('shareUserId').value; 786 var shareForm = BX('blogShare'); 787 var actUrl = socBPDest.shareUrl.replace(/#post_id#/, postId).replace(/#user_id#/, userId); 788 789 if (BX('sharePostSubmitButton')) 790 { 791 BX.addClass(BX('sharePostSubmitButton'), 'feed-add-button-load'); 792 } 793 794 shareForm.action = actUrl; 795 shareForm.target = ''; 796 797 var i, s = ""; 798 var n = shareForm.elements.length; 799 800 var delim = ''; 801 for(i=0; i<n; i++) 802 { 803 if (s != '') delim = '&'; 804 var el = shareForm.elements[i]; 805 if (el.disabled) 806 continue; 807 808 switch(el.type.toLowerCase()) 809 { 810 case 'text': 811 case 'hidden': 812 s += delim + el.name + '=' + BX.util.urlencode(el.value); 813 break; 814 default: 815 break; 816 } 817 } 818 s += "&save=Y&MODE=RECORD&AJAX_POST=Y&ENTITY_XML_ID=BLOG_" + postId; 819 820 var newNodes = renderSharingPost(postId); 821 822 BX.ajax({ 823 'method': 'POST', 824 'dataType': 'json', 825 'url': actUrl, 826 'data': s, 827// 'async': true, 828// 'processData': false, 829 'onsuccess': function(data) 830 { 831 if ( 832 typeof data == 'undefined' 833 || typeof data.status == 'undefined' 834 || data.status != 'success' 835 ) 836 { 837 hideRenderedSharingNodes(newNodes); 838 } 839 else 840 { 841 var true_data = data; 842 BX.onCustomEvent(window, 'OnUCAfterRecordAdd', ['BLOG_' + postId, data, true_data]); 843 } 844 }, 845 onfailure: function(data) 846 { 847 hideRenderedSharingNodes(newNodes); 848 } 849 }); 850 closeSharing(); 851}; 852 853window.renderSharingPost = function(postId) 854{ 855 var res = []; 856 var nodeId = ''; 857 858 var elements = BX.findChildren(BX('feed-add-post-destination-item-post'), {className : 'feed-add-post-destination'}, true); 859 if (elements != null) 860 { 861 var hiddenDest = BX('blog-destination-hidden-'+postId); 862 if(!hiddenDest) 863 { 864 var el = BX.findChildren(BX('blg-post-img-'+postId), {className : 'feed-add-post-destination-new'}, true); 865 var lastDest = el[el.length-1]; 866 } 867 868 for (var j = 0; j < elements.length; j++) 869 { 870 if(!BX.hasClass(elements[j], 'feed-add-post-destination-undelete')) 871 { 872 var name = BX.findChild(elements[j], {className: 'feed-add-post-destination-text' }, false, false).innerHTML; 873 var obj = BX.findChild(elements[j], {tag: 'input' }, false, false); 874 var id = obj.value; 875 var elementClassName = 'feed-add-post-destination-new'; 876 877 if(BX.hasClass(elements[j], 'feed-add-post-destination-email')) 878 { 879 elementClassName += ' feed-add-post-destination-new-email'; 880 } 881 else if (BX.hasClass(elements[j], 'feed-add-post-destination-extranet')) 882 { 883 elementClassName += ' feed-add-post-destination-new-extranet'; 884 } 885 886 var type; 887 if(obj.name == "SPERM[SG][]") 888 type = 'sonetgroups'; 889 else if(obj.name == "SPERM[DR][]") 890 type = 'department'; 891 else if(obj.name == "SPERM[G][]") 892 type = 'groups'; 893 else if(obj.name == "SPERM[U][]") 894 type = 'users'; 895 else if(obj.name == "SPERM[UE][]") 896 type = 'users'; 897 else if(obj.name == "SPERM[UA][]") 898 type = 'groups'; 899 900 if (type.length > 0) 901 { 902 window["postDest" + postId].push({ 903 id: id, 904 name: name, 905 type: type 906 }); 907 nodeId = 'post_' + postId + '_dest_' + id 908 res.push(nodeId); 909 910 var destText = BX.create("span", { 911 props: { 912 id: nodeId 913 }, 914 children: [ 915 BX.create("span", { 916 html : ', ' 917 }), 918 BX.create("a", { 919 props: { 920 className: elementClassName 921 }, 922 href: '', 923 html : name 924 }) 925 ]} 926 ); 927 if(hiddenDest) 928 { 929 hiddenDest.appendChild(destText); 930 } 931 else if(lastDest) 932 { 933 BX(lastDest.parentNode).insertBefore(destText, lastDest.nextSibling); 934 } 935 } 936 } 937 } 938 } 939 940 return res; 941}; 942 943window.hideRenderedSharingNodes = function(newNodes) 944{ 945 var nodeId = false;
946 for(i=0; i<newNodes.length; i++) 947 { 948 nodeId = newNodes[i]; 949 if (BX(nodeId)) 950 { 951 BX.cleanNode(BX(nodeId), true); 952 } 953 } 954 955};
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.