Posts: 2,530
Threads: 124
Joined: Jul 2011
Reputation:
293
2014-09-23, 12:29 PM
(This post was last modified: 2014-09-23, 12:32 PM by martec.)
(2014-09-23, 06:34 AM)Omar G. Wrote: @martec can you provide minified code (template code) that simply loads the editor as soon as the page is loaded? Removing as much JS as possible.
I have this:
So I want to remove unnecessary code (smiles box, load on focus, etc).
@Omar G. check this http://community.mybb.com/thread-155797.html
you can use Without Smilies box and with Quick Edit or Without Smilies box and Without Quick Edit of 1.2 version
but if you will use 1.2, you need unistall 4.0 completely....
Posts: 9,905
Threads: 399
Joined: Jan 2010
Reputation:
548
2014-09-24, 06:28 AM
(This post was last modified: 2014-09-24, 06:28 AM by Omar G..)
The plugin works fine for me, I just want to remove unnecessary JS code from the template if possible.
If not, it is fine as it is.
Soporte en Español
Discord at omar.gonzalez ( Omar G.#6117 ); Telegram at @omarugc ;
Posts: 2,530
Threads: 124
Joined: Jul 2011
Reputation:
293
(2014-09-24, 06:28 AM)Omar G. Wrote: The plugin works fine for me, I just want to remove unnecessary JS code from the template if possible.
If not, it is fine as it is.
???
link above exactly what are you looking for...
anyway...
in codebutquick
replace all code with (Ps. Not tested):
<link rel="stylesheet" href="{$mybb->asset_url}/jscripts/sceditor/editor_themes/{$theme['editortheme']}" type="text/css" media="all" />
<script type="text/javascript" src="{$mybb->asset_url}/jscripts/sceditor/jquery.sceditor.bbcode.min.js"></script>
<script type="text/javascript" src="{$mybb->asset_url}/jscripts/bbcodes_sceditor.js"></script>
<script type="text/javascript">
if($('#clickable_smilies').length) {
$('#clickable_smilies').closest('div').hide();
}
var partialmode = {$mybb->settings['partialmode']},
opt_editor = {
plugins: "bbcode",
height: 270,
style: "{$mybb->asset_url}/jscripts/sceditor/jquery.sceditor.mybb.css",
rtl: {$lang->settings['rtl']},
locale: "mybblang",
emoticonsEnabled: {$emoticons_enabled},
emoticons: {
// Emoticons to be included in the dropdown
dropdown: {
{$dropdownsmilies}
},
// Emoticons to be included in the more section
more: {
{$moresmilies}
},
// Emoticons that are not shown in the dropdown but will still be converted. Can be used for things like aliases
hidden: {
{$hiddensmilies}
}
},
emoticonsCompat: true,
toolbar: "{$basic1}{$align}{$font}{$size}{$color}{$removeformat}{$basic2}image,{$email}{$link}|video{$emoticon}|{$list}{$code}quote|maximize,source",
};
{$editor_language}
if({$mybb->settings['quickadveditor_qedit']}!=0) {
($.fn.on || $.fn.live).call($(document), 'focus', 'textarea[name*="value"]', function () {
$(this).sceditor(opt_editor);
setTimeout(function() {
if ($('textarea[name*="value"]').sceditor('instance')) {
$('textarea[name*="value"]').sceditor('instance').focus();
}
offset = $('textarea[name*="value"]').next().offset().top - 60;
setTimeout(function() {
$('html, body').animate({
scrollTop: offset
}, 700);
},200);
},100);
{$sourcemode}
});
}
$(document).ready(function() {
$('#message').sceditor(opt_editor);
MyBBEditor = $('#message').sceditor('instance');
{$sourcemode}
});
/**********************************
* Thread compatibility functions *
**********************************/
if(typeof Thread !== 'undefined')
{
var quickReplyFunc = Thread.quickReply;
Thread.quickReply = function(e) {
if(MyBBEditor) {
MyBBEditor.updateOriginal();
$('form[id*="quick_reply_form"]').bind('reset', function() {
MyBBEditor.val('').emoticons(true);
});
}
return quickReplyFunc.call(this, e);
};
};
</script>
Posts: 9,905
Threads: 399
Joined: Jan 2010
Reputation:
548
Even when I have the editor on source mod, when I click Quick Edit it appears on full mode.
Soporte en Español
Discord at omar.gonzalez ( Omar G.#6117 ); Telegram at @omarugc ;
Posts: 9,905
Threads: 399
Joined: Jan 2010
Reputation:
548
codebutquick is not being cached in show thread pages BTW.
Soporte en Español
Discord at omar.gonzalez ( Omar G.#6117 ); Telegram at @omarugc ;
Posts: 2,530
Threads: 124
Joined: Jul 2011
Reputation:
293
2014-09-28, 05:22 PM
(This post was last modified: 2014-09-29, 01:29 AM by martec.)
(2014-09-27, 06:49 AM)Omar G. Wrote: Even when I have the editor on source mod, when I click Quick Edit it appears on full mode.
replace with code below...
<link rel="stylesheet" href="{$mybb->asset_url}/jscripts/sceditor/editor_themes/{$theme['editortheme']}" type="text/css" media="all" />
<script type="text/javascript" src="{$mybb->asset_url}/jscripts/sceditor/jquery.sceditor.bbcode.min.js"></script>
<script type="text/javascript" src="{$mybb->asset_url}/jscripts/bbcodes_sceditor.js"></script>
<script type="text/javascript">
if($('#clickable_smilies').length) {
$('#clickable_smilies').closest('div').hide();
}
var partialmode = {$mybb->settings['partialmode']},
opt_editor = {
plugins: "bbcode",
height: 270,
style: "{$mybb->asset_url}/jscripts/sceditor/jquery.sceditor.mybb.css",
rtl: {$lang->settings['rtl']},
locale: "mybblang",
emoticonsEnabled: {$emoticons_enabled},
emoticons: {
// Emoticons to be included in the dropdown
dropdown: {
{$dropdownsmilies}
},
// Emoticons to be included in the more section
more: {
{$moresmilies}
},
// Emoticons that are not shown in the dropdown but will still be converted. Can be used for things like aliases
hidden: {
{$hiddensmilies}
}
},
emoticonsCompat: true,
toolbar: "{$basic1}{$align}{$font}{$size}{$color}{$removeformat}{$basic2}image,{$email}{$link}|video{$emoticon}|{$list}{$code}quote|maximize,source",
};
{$editor_language}
if({$mybb->settings['quickadveditor_qedit']}!=0) {
($.fn.on || $.fn.live).call($(document), 'focus', 'textarea[name*="value"]', function () {
$(this).sceditor(opt_editor);
setTimeout(function() {
if ($('textarea[name*="value"]').sceditor('instance')) {
$('textarea[name*="value"]').sceditor('instance').focus();
}
offset = $('textarea[name*="value"]').next().offset().top - 60;
setTimeout(function() {
$('html, body').animate({
scrollTop: offset
}, 700);
},200);
},100);
if('{$sourcemode}' != '') {
$('textarea[name*="value"]').sceditor('instance').sourceMode();
}
});
}
$(document).ready(function() {
$('#message').sceditor(opt_editor);
MyBBEditor = $('#message').sceditor('instance');
{$sourcemode}
});
/**********************************
* Thread compatibility functions *
**********************************/
if(typeof Thread !== 'undefined')
{
var quickReplyFunc = Thread.quickReply;
Thread.quickReply = function(e) {
if(MyBBEditor) {
MyBBEditor.updateOriginal();
$('form[id*="quick_reply_form"]').bind('reset', function() {
MyBBEditor.val('').emoticons(true);
});
}
return quickReplyFunc.call(this, e);
};
};
</script>
(2014-09-28, 04:57 PM)Omar G. Wrote: codebutquick is not being cached in show thread pages BTW.
you're right
add somthing this in plugin
$plugins->add_hook('global_start', 'advedt_cache_codebutquick');
function advedt_cache_codebutquick()
{
global $templatelist;
if (isset($templatelist)) {
$templatelist .= ',';
}
if (THIS_SCRIPT == 'showthread.php') {
$templatelist .= 'codebutquick';
}
}
Omar G. plz you could close this thread?
because has another one here http://community.mybb.com/thread-158367.html
5.1.0 released. Solved template cache issue. Thanks @Omar G.
Posts: 9,905
Threads: 399
Joined: Jan 2010
Reputation:
548
As per requested, please follow up the release thread instead of seeking for help in here.
http://community.mybb.com/thread-158367.html
Soporte en Español
Discord at omar.gonzalez ( Omar G.#6117 ); Telegram at @omarugc ;
|