Posted in: Newspaper
Feb 3, 2018 at 6:22 pm
Hi,
why there are a div in my homepage with this code? I’m not logged-in on wordpress, what this need?
<div id="tdw-css-writer" style="display: none" class="tdw-drag-dialog tdc-window-sidebar"> <header> <a title="Editor" href="#">Edit with Live CSS</a><div class="tdw-less-info" title="This will be red when errors are detected in your CSS and LESS"></div> </header><div class="tdw-content"><div class="tdw-tabs-content tdw-tab-editor tdc-tab-content-active"> <script>(function(jQuery, undefined) {
jQuery(window).ready(function() {
if ( 'undefined' !== typeof tdcAdminIFrameUI ) {
var $liveIframe = tdcAdminIFrameUI.getLiveIframe();
if ( $liveIframe.length ) {
$liveIframe.load(function() {
$liveIframe.contents().find( 'body').append( '<textarea class="tdw-css-writer-editor" style="display: none"></textarea>' );
});
}
}
});
})(jQuery);</script> <textarea class="tdw-css-writer-editor td_live_css_uid_1_5a75e0c2a3b33">.home-boxo-mini .td-custom {
border:2px solid #ececec;
}</textarea><div id="td_live_css_uid_1_5a75e0c2a3b33" class="td-code-editor"></div> <script>jQuery(window).load(function (){
if ( 'undefined' !== typeof tdLiveCssInject ) {
tdLiveCssInject.init();
var editor_textarea = jQuery('.td_live_css_uid_1_5a75e0c2a3b33');
var languageTools = ace.require("ace/ext/language_tools");
var tdcCompleter = {
getCompletions: function (editor, session, pos, prefix, callback) {
if (prefix.length === 0) {
callback(null, []);
return
}
if ('undefined' !== typeof tdcAdminIFrameUI) {
var data = {
error: undefined,
getShortcode: ''
};
tdcIFrameData.getShortcodeFromData(data);
if (!_.isUndefined(data.error)) {
tdcDebug.log(data.error);
}
if (!_.isUndefined(data.getShortcode)) {
var regex = /el_class=\"([A-Za-z0-9_-]*\s*)+\"/g,
results = data.getShortcode.match(regex);
var elClasses = {};
for (var i = 0; i < results.length; i++) {
var currentClasses = results[i]
.replace('el_class="', '')
.replace('"', '')
.split(' ');
for (var j = 0; j < currentClasses.length; j++) {
if (_.isUndefined(elClasses[currentClasses[j]])) {
elClasses[currentClasses[j]] = '';
}
}
}
var arrElClasses = [];
for (var prop in elClasses) {
arrElClasses.push(prop);
}
callback(null, arrElClasses.map(function (item) {
return {
name: item,
value: item,
meta: 'in_page'
}
}));
}
}
}
};
languageTools.addCompleter(tdcCompleter);
window.editor = ace.edit("td_live_css_uid_1_5a75e0c2a3b33");
// 'change' handler is written as function because it's called by tdc_on_add_css_live_components (of wp_footer hook)
// We did it to reattach the existing compiled css to the new content received from server.
window.editorChangeHandler = function () {
//tdwState.lessWasEdited = true;
window.onbeforeunload = function () {
if (tdwState.lessWasEdited) {
return "You have attempted to leave this page. Are you sure?";
}
return false;
};
var editorValue = editor.getSession().getValue();
editor_textarea.val(editorValue);
if ('undefined' !== typeof tdcAdminIFrameUI) {
tdcAdminIFrameUI.getLiveIframe().contents().find('.tdw-css-writer-editor:first').val(editorValue);
// Mark the content as modified
// This is important for showing info when composer closes
tdcMain.setContentModified();
}
tdLiveCssInject.less();
};
editor.getSession().setValue(editor_textarea.val());
editor.getSession().on('change', editorChangeHandler);
editor.setTheme("ace/theme/textmate");
editor.setShowPrintMargin(false);
editor.getSession().setMode("ace/mode/less");
editor.setOptions({
enableBasicAutocompletion: true,
enableSnippets: true,
enableLiveAutocompletion: false
});
}
});</script> </div></div><footer> <a href="#">Save</a><div class="tdw-more-info-text">Write CSS OR LESS and hit save. CTRL + SPACE for auto-complete.</div><div class="tdw-resize"></div> </footer></div>
-
This topic was modified 8 years by
vadoingiappone.
Feb 5, 2018 at 11:20 am
Hello you,
ok clear, but I think this code need only if I want to edit my page with page builder, right?
So, why if I visit a page and I’m not logged-in, the page must contain this unnecessary HTML + Javascript? Can be an idea, to optimize, remove it if i’m not logged on wordpress admin because no one need to edit my CSS live when visit my site.
Thanks you very much!
Fabrizio
Viewing 4 posts - 1 through 4 (of 4 total)
The forum ‘Newspaper’ is closed to new topics and replies.