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:not(.article-delete-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 var commentsConfigId = $(editorButton).attr('data-commments-config-id'); 50 51 function openEditor() { 52 var body = { 53 m: 'get_cb_flex_editor_auth_token' 54 }; 55 CbUx.showLoader(); 56 var domain = /:\/\/([^\/]+)/.exec(window.location.href)[1]; 57 $.get('https://' + domain + ENV.document_root + '/de_DE/auth.json', body, function (token) { 58// if (token) { 59 var url = $(editorButton).attr('data-url') + '&account=' + ENV.auth.account + '&token=' + token; 60 61 var newiFrameEditorCode = iFrameEditorCode; 62 newiFrameEditorCode = newiFrameEditorCode.replace(/%s/, url); 63 $(editorButton).after(newiFrameEditorCode); 64 65 $(".draggable").draggable({scroll: false}); 66 67 $(window).scrollTop(0); 68 69 registerEventListener(); 70 CbUx.hideLoader(); 71// } 72 }); 73 } 74 75 if ($(editorButton).hasClass("comments-config-edit-button") && commentsConfigId == "") { 76 var body = { 77 m: 'new_comments_config', 78 page_id: $(editorButton).data('page-id'), 79 film_id: $(editorButton).data('film-id'), 80 language_id: ENV.id_language 81 }; 82 CbUx.showLoader(); 83 $.get('https://' + ENV.server_url + ENV.document_root + '/de_DE/page.json', body, function (data) { 84 $(editorButton).attr('data-url', ($(editorButton).data('url') + data.comments_config_id)); 85 openEditor(); 86 }); 87 } else if (articleId == "") { 88 var body = { 89 m: 'new_article', 90 page_id: $(editorButton).data('page-id'), 91 language_id: ENV.id_language 92 }; 93 CbUx.showLoader(); 94 $.get('https://' + ENV.server_url + ENV.document_root + '/de_DE/page.json', body, function (data) { 95 $(editorButton).attr('data-url', ($(editorButton).data('url') + data.article_id)); 96 openEditor(); 97 }); 98 } else { 99 openEditor(); 100 } 101 102 103 104 } 105 }); 106 107 $('.btn-post-entry').on('click', function () { 108 if (ENV.auth && $(this).hasClass('is-blog-author')) { 109 $('#page-window, #page-window-layer').addClass('show'); 110 } else { 111 openRegisterLoginLayer(); 112 } 113 }); 114 115 $('#page-window .close-button').on('click', function () { 116 $('#page-window, #page-window-layer').removeClass('show'); 117 }); 118 119 $('#page-window .create-page-button').on('click', function () { 120 121 if ($('#page-window #input-field-title').val() != "" && $("select.new-page-select").val() !== null) { 122 var body = { 123 m: 'new_article_and_blog_item', 124 language_id: ENV.id_language, 125 title: $('#page-window #input-field-title').val(), 126 tag_id: $("select.new-page-select").val(), 127 tag_group_id: 3 128 }; 129 130 CbUx.showLoader(); 131 $.get(ENV.link_root + '/page.json', body, function (data) { 132 window.location.href = data.page_url; 133 }); 134 } else { 135 CbUx.showMessage('page_window_error_text', 'page_window_error_text_headline'); 136 } 137 138 139 140 }); 141 142 $('.cb-flex-editor-button.article-delete-button').unbind('click').on('click', function (e) { 143 var article_id = $(this).data('article-id');
144 CbUx.confirm("delete_article_confirm_header", "delete_article_confirm_text", function () { 145 var body = { 146 m: 'delete_article_and_blog_item', 147 article_id: article_id 148 }; 149 150 CbUx.showLoader(); 151 $.get(ENV.link_root + '/page.json', body, function (data) { 152 window.location.href = ENV.link_root + '/blog'; 153 }); 154 }); 155 156 }); 157 158 var hash = window.location.hash; 159 if (hash === "#openeditor") { 160 $('.cb-flex-editor-button.article-editor-button').first().click(); 161 window.location.hash = ''; 162 } 163});
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.