javascript code work with members but doesn't with visiteurs
3 posters
Page 1 of 1
javascript code work with members but doesn't with visiteurs
hello there i hope you are doing well
i have this code made to me by @ Ange Tuteur
and modified a bit by @pedxz
i did post this issue in the arabic forum support and no one could solve it
so here i am
with members the code work just fine
the issue is that the code doesn't work with visteur
a video to show the issue
the code
i have this code made to me by @ Ange Tuteur
and modified a bit by @pedxz
i did post this issue in the arabic forum support and no one could solve it
so here i am
with members the code work just fine
the issue is that the code doesn't work with visteur
a video to show the issue
the code
- Code:
$(function() {
if (!$.sceditor) return;
$.sceditor.command.set('cmd', {
dropDown : function(editor, caller, callback) {
var content = $(
'<div>' +
' <div>' +
' <label>رابط</label>' +
' <input type="text" placeholder="رابط الخلفية" id="cmdValue" value="" />' +
' </div>' +
' <div>' +
' <input type="button" class="button" value="ادخال الخلفية">' +
' </div>' +
'</div>'
);
content.find('.button').click(function(e) {
callback(content.find('select').val());
editor.closeDropDown(true);
});
editor.createDropDown(caller, "cmd", content);
},
// WYSIWYG MODE
exec : function(caller) {
var editor = this;
$.sceditor.command.get('cmd').dropDown(editor, caller, function(cmd) {
var before = '[tbl]', title = $('#cmdValue').val();
if(title !== '') {
before = '[tbl=' + title + ']';
editor.wysiwygEditorInsertHtml(before);
}
});
},
// SOURCE MODE
txtExec : function(caller) {
var editor = this;
$.sceditor.command.get('cmd').dropDown(editor, caller, function(cmd) {
var title = $('#cmdValue').val();
if(title) {
editor.insertText('[tbl=' + title + ']');
} else {
editor.insertText('[tbl=' + title + ']');
}
});
}, tooltip: "خلفية الموضوع"});
for (var a = $('.post .content'), i = 0, j = a.length; i < j; i++) {
if (/\[tbl=.*?\]/i.test(a[i].innerHTML)) {
a[i].innerHTML = a[i].innerHTML.replace(/\[tbl=(.*?)\]/i, function(M, $1) {
a[i].style.backgroundImage = 'url(' + $1 + ')';
return '';
});
}
}
toolbar = toolbar.replace(/image/,'cmd,image');
$('head').append(
'<style type="text/css">' +
'.sceditor-button-cmd div {' +
' background:url(https://cdn2.iconfinder.com/data/icons/circle-icons-1/64/image-16.png) !important}' +
' .sceditor-cmd {' +
' width:auto;' +
' height:auto;' +
' overflow-y:auto;' +
'}' +
'.sceditor-cmd select {' +
' margin: 0 0 .75em;' +
'}' +
'</style>'
);
});
Last edited by alla13 on May 31st 2018, 3:49 pm; edited 1 time in total
Re: javascript code work with members but doesn't with visiteurs
So the issue is that a code appears when you are a visitor?
Lost Founder's Password |Forum's Utilities |Report a Forum |General Rules |FAQ |Tricks & Tips
You need one post to send a PM.
You need one post to send a PM.
When your topic has been solved, ensure you mark the topic solved.
Never post your email in public.
Re: javascript code work with members but doesn't with visiteurs
yes, instead of a background the code shows up like the java does not work
Re: javascript code work with members but doesn't with visiteurs
Everything (SCEditor button and the tag effect) is in the same function. That function is aborted in the very start if the SCEditor text area is not found, which happens in guest mode but also in closed topics, etc. That's where this bug comes from. You can simply change it to 2 different functions, so only de button function is aborted.
This should work
- Code:
$(function() {
if (!$.sceditor) return;
$.sceditor.command.set('cmd', {
dropDown : function(editor, caller, callback) {
var content = $(
'<div>' +
' <div>' +
' <label>رابط</label>' +
' <input type="text" placeholder="رابط الخلفية" id="cmdValue" value="" />' +
' </div>' +
' <div>' +
' <input type="button" class="button" value="ادخال الخلفية">' +
' </div>' +
'</div>'
);
content.find('.button').click(function(e) {
callback(content.find('select').val());
editor.closeDropDown(true);
});
editor.createDropDown(caller, "cmd", content);
},
// WYSIWYG MODE
exec : function(caller) {
var editor = this;
$.sceditor.command.get('cmd').dropDown(editor, caller, function(cmd) {
var before = '[tbl]', title = $('#cmdValue').val();
if(title !== '') {
before = '[tbl=' + title + ']';
editor.wysiwygEditorInsertHtml(before);
}
});
},
// SOURCE MODE
txtExec : function(caller) {
var editor = this;
$.sceditor.command.get('cmd').dropDown(editor, caller, function(cmd) {
var title = $('#cmdValue').val();
if(title) {
editor.insertText('[tbl=' + title + ']');
} else {
editor.insertText('[tbl=' + title + ']');
}
});
}, tooltip: "خلفية الموضوع"});
toolbar = toolbar.replace(/image/,'cmd,image');
});
$(function() {
for (var a = $('.post .content'), i = 0, j = a.length; i < j; i++) {
if (/\[tbl=.*?\]/i.test(a[i].innerHTML)) {
a[i].innerHTML = a[i].innerHTML.replace(/\[tbl=(.*?)\]/i, function(M, $1) {
a[i].style.backgroundImage = 'url(' + $1 + ')';
return '';
});
}
}
$('head').append(
'<style type="text/css">' +
'.sceditor-button-cmd div {' +
' background:url(https://cdn2.iconfinder.com/data/icons/circle-icons-1/64/image-16.png) !important}' +
' .sceditor-cmd {' +
' width:auto;' +
' height:auto;' +
' overflow-y:auto;' +
'}' +
'.sceditor-cmd select {' +
' margin: 0 0 .75em;' +
'}' +
'</style>'
);
});
This should work
Wecoc- Forumember
- Posts : 144
Reputation : 111
Language : Catalan, Spanish, English
Re: javascript code work with members but doesn't with visiteurs
@Wecoc
thank you very much topic solved
but another problem show up
the guest can't reply now
even when i give them permission
nevermind i solved the issue
thank you very much topic solved
the guest can't reply now
even when i give them permission
nevermind i solved the issue
Re: javascript code work with members but doesn't with visiteurs
Problem solved & topic archived.
|
Lost Founder's Password |Forum's Utilities |Report a Forum |General Rules |FAQ |Tricks & Tips
You need one post to send a PM.
You need one post to send a PM.
When your topic has been solved, ensure you mark the topic solved.
Never post your email in public.
Similar topics
» Automatic Form javascript code don't work anymore on ModernBB
» chatbox java doesnt work
» FMChat - auto login doesnt work
» search doesnt work?
» Javascript Codes don't work
» chatbox java doesnt work
» FMChat - auto login doesnt work
» search doesnt work?
» Javascript Codes don't work
Page 1 of 1
Permissions in this forum:
You cannot reply to topics in this forum