1$(document).ready(function () { 2 3 var editorIsOpen = false; 4 5 function handleMessage(event) { 6 console.log("Received a message from " + event.origin + "."); 7 8 // When one window sends a message, or data, to another window via 9 // `parent.postMessage()`, the message (the first argument) in the 10 // `parent.postMessage()` call is accessible via `event.data` here. 11 var messageFromSender = event.data; 12 13 // Do something with the data. 14 console.log(messageFromSender); 15 16 if (messageFromSender.close_editor === true) { 17 $('.editorWrapper').remove(); 18 editorIsOpen = false; 19 CbUx.showLoader(); 20 window.location.reload(); 21 } 22 } 23 24 function registerEventListener() { 25 setTimeout(function () { 26 if (window.addEventListener) { 27 window.addEventListener("message", handleMessage); 28 } else { 29 window.attachEvent("onmessage", handleMessage); 30 } 31 }, 500); 32 } 33 34 35 36 var iFrameEditorCode = '<div class="editorContainer">' + '<div class="editorWrapper resizable draggable" style="position: absolute;left: auto;top: auto;z-index: 99999;height: auto;min-height: 600px;width: 930px;max-width: 930px;">' + 37 '<div class="__EditorWindowDraggableButton draggable-handler" title=""></div>' + 38 '<iframe width="560" height="349" src="%s" frameborder="0" allowfullscreen style="position: absolute;top: 0px;left: 0;width: 100%;height: calc(100% - 0px);"></iframe>' + 39 '</div>' + 40 '</div>'; 41 42 $('.cb-flex-editor-button').unbind('click').on('click', function (e) { 43 if (editorIsOpen === false && ENV.auth) { 44 editorIsOpen = true; 45 var editorButton = $(this); 46 $("body").addClass('editor-open'); 47 48 var articleId = $(editorButton).attr('data-article-id'); 49 50 function openEditor() { 51 var body = { 52 m: 'get_cb_flex_editor_auth_token' 53 }; 54 CbUx.showLoader(); 55 var domain = /:\/\/([^\/]+)/.exec(window.location.href)[1]; 56 $.get('https://' + domain + ENV.document_root + '/de_DE/auth.json', body, function (token) { 57// if (token) { 58 var url = $(editorButton).attr('data-url') + '&account=' + ENV.auth.account + '&token=' + token; 59 60 var newiFrameEditorCode = iFrameEditorCode; 61 newiFrameEditorCode = newiFrameEditorCode.replace(/%s/, url); 62 $(editorButton).after(newiFrameEditorCode); 63 64 $(".draggable").draggable({scroll: false}); 65 66 $(window).scrollTop(0); 67 68 registerEventListener(); 69 CbUx.hideLoader(); 70// } 71 }); 72 } 73 74 if (articleId == "") { 75 var body = { 76 m: 'new_article', 77 page_id: $(editorButton).data('page-id'), 78 language_id: ENV.id_language 79 }; 80 CbUx.showLoader(); 81 $.get('https://' + ENV.server_url + ENV.document_root + '/de_DE/page.json', body, function (data) { 82 $(editorButton).attr('data-url', ($(editorButton).data('url') + data.article_id)); 83 openEditor(); 84 }); 85 } else { 86 openEditor(); 87 } 88 89 90 91 } 92 }); 93 94 95});
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.