MyBB Community Forums

Full Version: Any jQuery scipts in headerincluded breaks MyCode Buttons
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Tried all the solutions found on the board. Even the standalone
<script type="text/javascript">jQuery.noConflict();</script>

is enough to cause the board to remove the mycode button execution. 

I'm taking advice from this thread and others which lead me to this thread. I have also looked at post #6 on that thread.

Currently my headerincluded looks like this:

<link rel="alternate" type="application/rss+xml" title="{$lang->latest_threads} (RSS 2.0)" href="{$mybb->settings['bburl']}/syndication.php" />
<link rel="alternate" type="application/atom+xml" title="{$lang->latest_threads} (Atom 1.0)" href="{$mybb->settings['bburl']}/syndication.php?type=atom1.0" />
<meta http-equiv="Content-Type" content="text/html; charset={$charset}" />
<meta http-equiv="Content-Script-Type" content="text/javascript" />
<script type="text/javascript" src="{$mybb->asset_url}/jscripts/general.js?ver=1815"></script>
<script type="text/javascript" src="{$mybb->asset_url}/jscripts/jquery.js?ver=1813"></script>
<script type="text/javascript" src="{$mybb->asset_url}/jscripts/jquery.plugins.min.js?ver=1813"></script>
<link rel="stylesheet" href="{$mybb->asset_url}/images/a/font/font-awesome.min.css">
<link rel="stylesheet" href="{$mybb->asset_url}/images/a/font/font-awesome-ie7.min.css">
{$stylesheets}
<script type="text/javascript">
<!--
	lang.unknown_error = "{$lang->unknown_error}";

	lang.select2_match = "{$lang->select2_match}";
	lang.select2_matches = "{$lang->select2_matches}";
	lang.select2_nomatches = "{$lang->select2_nomatches}";
	lang.select2_inputtooshort_single = "{$lang->select2_inputtooshort_single}";
	lang.select2_inputtooshort_plural = "{$lang->select2_inputtooshort_plural}";
	lang.select2_inputtoolong_single = "{$lang->select2_inputtoolong_single}";
	lang.select2_inputtoolong_plural = "{$lang->select2_inputtoolong_plural}";
	lang.select2_selectiontoobig_single = "{$lang->select2_selectiontoobig_single}";
	lang.select2_selectiontoobig_plural = "{$lang->select2_selectiontoobig_plural}";
	lang.select2_loadmore = "{$lang->select2_loadmore}";
	lang.select2_searching = "{$lang->select2_searching}";

	var cookieDomain = "{$mybb->settings['cookiedomain']}";
	var cookiePath = "{$mybb->settings['cookiepath']}";
	var cookiePrefix = "{$mybb->settings['cookieprefix']}";
	var cookieSecureFlag = "{$mybb->settings['cookiesecureflag']}";
	var deleteevent_confirm = "{$lang->deleteevent_confirm}";
	var removeattach_confirm = "{$lang->removeattach_confirm}";
	var loading_text = '{$lang->ajax_loading}';
	var saving_changes = '{$lang->saving_changes}';
	var use_xmlhttprequest = "{$mybb->settings['use_xmlhttprequest']}";
	var my_post_key = "{$mybb->post_code}";
	var rootpath = "{$mybb->settings['bburl']}";
	var imagepath = "{$theme['imgdir']}";
  	var yes_confirm = "{$lang->yes}";
	var no_confirm = "{$lang->no}";
	var MyBBEditor = null;
	var spinner_image = "{$theme['imgdir']}/spinner.gif";
	var spinner = "<img src='" + spinner_image +"' alt='' />";
	var modal_zindex = 9999;
// -->
</script>

Which should be close to default other than the adding of fontawesome.

 I'm currently trying to make it look like this:


<link rel="alternate" type="application/rss+xml" title="{$lang->latest_threads} (RSS 2.0)" href="{$mybb->settings['bburl']}/syndication.php" />
<link rel="alternate" type="application/atom+xml" title="{$lang->latest_threads} (Atom 1.0)" href="{$mybb->settings['bburl']}/syndication.php?type=atom1.0" />
<meta http-equiv="Content-Type" content="text/html; charset={$charset}" />
<meta http-equiv="Content-Script-Type" content="text/javascript" />
<script type="text/javascript" src="{$mybb->asset_url}/jscripts/general.js?ver=1815"></script>
<script type="text/javascript" src="{$mybb->asset_url}/jscripts/jquery.js?ver=1813"></script>
<script type="text/javascript" src="{$mybb->asset_url}/jscripts/jquery.plugins.min.js?ver=1813"></script>
<script type="text/javascript" src="{$mybb->asset_url}/images/a/js/sidebar.js"></script>
<script type="text/javascript" src="{$mybb->asset_url}/images/a/js/ddes.js"></script>
<script type="text/javascript">
jQuery.noConflict();

jQuery(document).ready(function($) {
    $('.dropDownHook span').on('click', function() {
        $(this).parents('.dropDownHook').children('.dropDownContent').stop(true, true).slideToggle('fast', function() {

            if ($('.dropDownContent').is(':visible')) {
                $('.dropDownHook span').html('Welcome {$mybb->user['username']} ▲');
            }
            else {
                $('.dropDownHook span').html('Welcome {$mybb->user['username']} ▼');
            }

        });
    });
    
    $('html').on('click', function() {
        $('.dropDownContent:visible').slideToggle('fast');
    });

    $('.dropDownHook > *').on('click', function(event) {
        event.stopPropagation();
    });
});
</script>
<link rel="stylesheet" href="{$mybb->asset_url}/images/a/font/font-awesome.min.css">
<link rel="stylesheet" href="{$mybb->asset_url}/images/a/font/font-awesome-ie7.min.css">
{$stylesheets}
<script type="text/javascript">
<!--
	lang.unknown_error = "{$lang->unknown_error}";

	lang.select2_match = "{$lang->select2_match}";
	lang.select2_matches = "{$lang->select2_matches}";
	lang.select2_nomatches = "{$lang->select2_nomatches}";
	lang.select2_inputtooshort_single = "{$lang->select2_inputtooshort_single}";
	lang.select2_inputtooshort_plural = "{$lang->select2_inputtooshort_plural}";
	lang.select2_inputtoolong_single = "{$lang->select2_inputtoolong_single}";
	lang.select2_inputtoolong_plural = "{$lang->select2_inputtoolong_plural}";
	lang.select2_selectiontoobig_single = "{$lang->select2_selectiontoobig_single}";
	lang.select2_selectiontoobig_plural = "{$lang->select2_selectiontoobig_plural}";
	lang.select2_loadmore = "{$lang->select2_loadmore}";
	lang.select2_searching = "{$lang->select2_searching}";

	var cookieDomain = "{$mybb->settings['cookiedomain']}";
	var cookiePath = "{$mybb->settings['cookiepath']}";
	var cookiePrefix = "{$mybb->settings['cookieprefix']}";
	var cookieSecureFlag = "{$mybb->settings['cookiesecureflag']}";
	var deleteevent_confirm = "{$lang->deleteevent_confirm}";
	var removeattach_confirm = "{$lang->removeattach_confirm}";
	var loading_text = '{$lang->ajax_loading}';
	var saving_changes = '{$lang->saving_changes}';
	var use_xmlhttprequest = "{$mybb->settings['use_xmlhttprequest']}";
	var my_post_key = "{$mybb->post_code}";
	var rootpath = "{$mybb->settings['bburl']}";
	var imagepath = "{$theme['imgdir']}";
  	var yes_confirm = "{$lang->yes}";
	var no_confirm = "{$lang->no}";
	var MyBBEditor = null;
	var spinner_image = "{$theme['imgdir']}/spinner.gif";
	var spinner = "<img src='" + spinner_image +"' alt='' />";
	var modal_zindex = 9999;
// -->
</script>
{$newpmmsg}
<script type="text/javascript" src="{$mybb->asset_url}/images/a/js/tipsy.js"></script>
<script type='text/javascript'> 
jQuery.noConflict();
jQuery(function() {
jQuery("a").tipsy({gravity: jQuery.fn.tipsy.autoNS, fade: true});
jQuery("img").tipsy({gravity: jQuery.fn.tipsy.autoNS, fade: true});
  });
</script>

The jQuery alone works fine. I know this because I'm about to get tipsy.js to work and the drop down menu works fine; but at the cost of the mycode editor.

I understand this thread is a bit messy, and I wouldn't expect anyone to sit here and fix up the whole code, but a pointer in the right direction would be nice.
if the default headerinclude template is giving problem then there is some other conflict somewhere else.

in general, jQuery noconflict code is not required in MyBB 1.8.x

do you have any plugins installed - if so, which plugins ?
can we have your forum url & which theme you are using ..
URL: ommited

Image of the Plugins
[Image: 75qvGYa.png]

I've had a theme from 1.6 called Flat Desire and finally got around to upgrading it.
I've mainly sorted out everything not needed to be upgraded.

Test account
user: omitted
pass: omitted

I've reverted the changes back to what they were when I was getting the error. Thank you for the help! And the default headerincluded does not give me other errors, other than not having my few snippets of code in there
do you have MyBB's Stock theme to check ?
looks like users cannot switch to the Stock theme.

referred theme's sidebar.js file has jquery noconflict code.
basically that noconflict code needs to be removed from the file
jQuery.noConflict();

moreover that sidebar.js file's code might need modifications to
work with the recent versions of MyBB

also as you might be knowing, ssl is not working properly.
if the certificate is installed then you have to change board url to https

[https : more details]
(2018-03-22, 05:11 AM).m. Wrote: [ -> ]do you have MyBB's Stock theme to check ?
looks like users cannot switch to the Stock theme.

referred theme's sidebar.js file has jquery noconflict code.
basically that noconflict code needs to be removed from the file
jQuery.noConflict();

moreover that sidebar.js file's code might need modifications to
work with the recent versions of MyBB

also as you might be knowing, ssl is not working properly.
if the certificate is installed then you have to change board url to https

[https : more details]

No SSL currently, the forum is currently in development. Thanks for the info, I'll look into it tomorrow and give you an update!
You have to load the general.js after jquery and jquery.plugins and you don't need the noConflict():

<link rel="alternate" type="application/rss+xml" title="{$lang->latest_threads} (RSS 2.0)" href="{$mybb->settings['bburl']}/syndication.php" />
<link rel="alternate" type="application/atom+xml" title="{$lang->latest_threads} (Atom 1.0)" href="{$mybb->settings['bburl']}/syndication.php?type=atom1.0" />
<meta http-equiv="Content-Type" content="text/html; charset={$charset}" />
<meta http-equiv="Content-Script-Type" content="text/javascript" />
<script type="text/javascript" src="{$mybb->asset_url}/jscripts/jquery.js?ver=1813"></script>
<script type="text/javascript" src="{$mybb->asset_url}/jscripts/jquery.plugins.min.js?ver=1813"></script>
<script type="text/javascript" src="{$mybb->asset_url}/jscripts/general.js?ver=1815"></script>
<script type="text/javascript" src="{$mybb->asset_url}/images/a/js/sidebar.js"></script>
<script type="text/javascript" src="{$mybb->asset_url}/images/a/js/ddes.js"></script>
<script type="text/javascript">
jQuery(document).ready(function($) {
   $('.dropDownHook span').on('click', function() {
       $(this).parents('.dropDownHook').children('.dropDownContent').stop(true, true).slideToggle('fast', function() {

           if ($('.dropDownContent').is(':visible')) {
               $('.dropDownHook span').html('Welcome {$mybb->user['username']} ▲');
           }
           else {
               $('.dropDownHook span').html('Welcome {$mybb->user['username']} ▼');
           }

       });
   });
   
   $('html').on('click', function() {
       $('.dropDownContent:visible').slideToggle('fast');
   });

   $('.dropDownHook > *').on('click', function(event) {
       event.stopPropagation();
   });
});
</script>
<link rel="stylesheet" href="{$mybb->asset_url}/images/a/font/font-awesome.min.css">
<link rel="stylesheet" href="{$mybb->asset_url}/images/a/font/font-awesome-ie7.min.css">
{$stylesheets}
<script type="text/javascript">
<!--
    lang.unknown_error = "{$lang->unknown_error}";

    lang.select2_match = "{$lang->select2_match}";
    lang.select2_matches = "{$lang->select2_matches}";
    lang.select2_nomatches = "{$lang->select2_nomatches}";
    lang.select2_inputtooshort_single = "{$lang->select2_inputtooshort_single}";
    lang.select2_inputtooshort_plural = "{$lang->select2_inputtooshort_plural}";
    lang.select2_inputtoolong_single = "{$lang->select2_inputtoolong_single}";
    lang.select2_inputtoolong_plural = "{$lang->select2_inputtoolong_plural}";
    lang.select2_selectiontoobig_single = "{$lang->select2_selectiontoobig_single}";
    lang.select2_selectiontoobig_plural = "{$lang->select2_selectiontoobig_plural}";
    lang.select2_loadmore = "{$lang->select2_loadmore}";
    lang.select2_searching = "{$lang->select2_searching}";

    var cookieDomain = "{$mybb->settings['cookiedomain']}";
    var cookiePath = "{$mybb->settings['cookiepath']}";
    var cookiePrefix = "{$mybb->settings['cookieprefix']}";
    var cookieSecureFlag = "{$mybb->settings['cookiesecureflag']}";
    var deleteevent_confirm = "{$lang->deleteevent_confirm}";
    var removeattach_confirm = "{$lang->removeattach_confirm}";
    var loading_text = '{$lang->ajax_loading}';
    var saving_changes = '{$lang->saving_changes}';
    var use_xmlhttprequest = "{$mybb->settings['use_xmlhttprequest']}";
    var my_post_key = "{$mybb->post_code}";
    var rootpath = "{$mybb->settings['bburl']}";
    var imagepath = "{$theme['imgdir']}";
     var yes_confirm = "{$lang->yes}";
    var no_confirm = "{$lang->no}";
    var MyBBEditor = null;
    var spinner_image = "{$theme['imgdir']}/spinner.gif";
    var spinner = "<img src='" + spinner_image +"' alt='' />";
    var modal_zindex = 9999;
// -->
</script>
{$newpmmsg}
<script type="text/javascript" src="{$mybb->asset_url}/images/a/js/tipsy.js"></script>
<script type='text/javascript'> 
jQuery(function() {
jQuery("a").tipsy({gravity: jQuery.fn.tipsy.autoNS, fade: true});
jQuery("img").tipsy({gravity: jQuery.fn.tipsy.autoNS, fade: true});
 });
</script>
(2018-03-22, 05:11 AM).m. Wrote: [ -> ]do you have MyBB's Stock theme to check ?
looks like users cannot switch to the Stock theme.

referred theme's sidebar.js file has jquery noconflict code.
basically that noconflict code needs to be removed from the file
jQuery.noConflict();

moreover that sidebar.js file's code might need modifications to
work with the recent versions of MyBB

also as you might be knowing, ssl is not working properly.
if the certificate is installed then you have to change board url to https

[https : more details]

Just an update. Completely removed the sidebar and commented out all cases that use it in the templates. And with no avail. I'll be reviewing every template tonight when I get released from work.

tl;dr removing sidebar.js proved ineffective.

(2018-03-22, 07:41 AM)doylecc Wrote: [ -> ]You have to load the general.js after jquery and jquery.plugins and you don't need the noConflict():

<link rel="alternate" type="application/rss+xml" title="{$lang->latest_threads} (RSS 2.0)" href="{$mybb->settings['bburl']}/syndication.php" />
<link rel="alternate" type="application/atom+xml" title="{$lang->latest_threads} (Atom 1.0)" href="{$mybb->settings['bburl']}/syndication.php?type=atom1.0" />
<meta http-equiv="Content-Type" content="text/html; charset={$charset}" />
<meta http-equiv="Content-Script-Type" content="text/javascript" />
<script type="text/javascript" src="{$mybb->asset_url}/jscripts/jquery.js?ver=1813"></script>
<script type="text/javascript" src="{$mybb->asset_url}/jscripts/jquery.plugins.min.js?ver=1813"></script>
<script type="text/javascript" src="{$mybb->asset_url}/jscripts/general.js?ver=1815"></script>
<script type="text/javascript" src="{$mybb->asset_url}/images/a/js/sidebar.js"></script>
<script type="text/javascript" src="{$mybb->asset_url}/images/a/js/ddes.js"></script>
<script type="text/javascript">
jQuery(document).ready(function($) {
   $('.dropDownHook span').on('click', function() {
       $(this).parents('.dropDownHook').children('.dropDownContent').stop(true, true).slideToggle('fast', function() {

           if ($('.dropDownContent').is(':visible')) {
               $('.dropDownHook span').html('Welcome {$mybb->user['username']} ▲');
           }
           else {
               $('.dropDownHook span').html('Welcome {$mybb->user['username']} ▼');
           }

       });
   });
   
   $('html').on('click', function() {
       $('.dropDownContent:visible').slideToggle('fast');
   });

   $('.dropDownHook > *').on('click', function(event) {
       event.stopPropagation();
   });
});
</script>
<link rel="stylesheet" href="{$mybb->asset_url}/images/a/font/font-awesome.min.css">
<link rel="stylesheet" href="{$mybb->asset_url}/images/a/font/font-awesome-ie7.min.css">
{$stylesheets}
<script type="text/javascript">
<!--
    lang.unknown_error = "{$lang->unknown_error}";

    lang.select2_match = "{$lang->select2_match}";
    lang.select2_matches = "{$lang->select2_matches}";
    lang.select2_nomatches = "{$lang->select2_nomatches}";
    lang.select2_inputtooshort_single = "{$lang->select2_inputtooshort_single}";
    lang.select2_inputtooshort_plural = "{$lang->select2_inputtooshort_plural}";
    lang.select2_inputtoolong_single = "{$lang->select2_inputtoolong_single}";
    lang.select2_inputtoolong_plural = "{$lang->select2_inputtoolong_plural}";
    lang.select2_selectiontoobig_single = "{$lang->select2_selectiontoobig_single}";
    lang.select2_selectiontoobig_plural = "{$lang->select2_selectiontoobig_plural}";
    lang.select2_loadmore = "{$lang->select2_loadmore}";
    lang.select2_searching = "{$lang->select2_searching}";

    var cookieDomain = "{$mybb->settings['cookiedomain']}";
    var cookiePath = "{$mybb->settings['cookiepath']}";
    var cookiePrefix = "{$mybb->settings['cookieprefix']}";
    var cookieSecureFlag = "{$mybb->settings['cookiesecureflag']}";
    var deleteevent_confirm = "{$lang->deleteevent_confirm}";
    var removeattach_confirm = "{$lang->removeattach_confirm}";
    var loading_text = '{$lang->ajax_loading}';
    var saving_changes = '{$lang->saving_changes}';
    var use_xmlhttprequest = "{$mybb->settings['use_xmlhttprequest']}";
    var my_post_key = "{$mybb->post_code}";
    var rootpath = "{$mybb->settings['bburl']}";
    var imagepath = "{$theme['imgdir']}";
     var yes_confirm = "{$lang->yes}";
    var no_confirm = "{$lang->no}";
    var MyBBEditor = null;
    var spinner_image = "{$theme['imgdir']}/spinner.gif";
    var spinner = "<img src='" + spinner_image +"' alt='' />";
    var modal_zindex = 9999;
// -->
</script>
{$newpmmsg}
<script type="text/javascript" src="{$mybb->asset_url}/images/a/js/tipsy.js"></script>
<script type='text/javascript'> 
jQuery(function() {
jQuery("a").tipsy({gravity: jQuery.fn.tipsy.autoNS, fade: true});
jQuery("img").tipsy({gravity: jQuery.fn.tipsy.autoNS, fade: true});
 });
</script>
Tried this. All it did was brick jquery from being used at all.

So just to refresh from the top.
---

I actually cut out posting this before I got to work. I was referring to what @.m. had said about removing noConflict instances. This had been the case for all the scripts I had wrote. Works perfectly now. Thank you for pointing me in the right direction .m.