Webboard

Pełna wersja: Konflikty pod dodaniu javascript
Aktualnie przeglądasz uproszczoną wersję forum. Kliknij tutaj, by zobaczyć wersję z pełnym formatowaniem.
wersja skryptu MyBB: 1.6.10
adres forum: http://new-generation.xaa.pl/
na czym polega problem (screen, opis, komunikaty, nazwa stylu/theme/szablonu):
Po dodaniu jakiegokolwiek skryptu do headerinclude przestaje działać panel użytkownika wysuwany na głównej - po prostu się nie wysuwa. Dlaczego tak sie dzieje? Jest linijka z noConflict.

Kod:
<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->settings['bburl']}/jscripts/prototype.js?ver=1603"></script>
<script type="text/javascript" src="{$mybb->settings['bburl']}/jscripts/general.js?ver=1603"></script>
<script type="text/javascript" src="{$mybb->settings['bburl']}/jscripts/popup_menu.js?ver=1600"></script>
<script type="text/javascript" src="http://code.jquery.com/jquery-latest.js"></script>
<script type="text/javascript" src="{$mybb->settings['bburl']}/jscripts/jquery.leanModal.min.js"></script>
<script type="text/javascript" src="{$mybb->settings['bburl']}/jscripts/jquery.idTabs.min.js"></script>
<script type="text/javascript">jQuery.noConflict();</script>
<script type="text/javascript" src="{$mybb->settings['bburl']}/images/carbon/js/login.js"></script>
<script type="text/javascript">
jQuery(function() {
jQuery('a[rel*=leanModal]').leanModal({ top : 200, closeButton: ".modal_close" });
});
</script>
<script type="text/javascript">
    jQuery(document).ready(function(){
     jQuery('#loged-toggle').click(function() {
      jQuery('#loged-content').slideToggle(300, function() {
      jQuery("#loged-toggle p").toggle();
      });
     });
    });
</script>
<script type="text/javascript">
jQuery(document).ready(function()
{
    jQuery('div.htmltabs div.tabsContent').hide();//tabsContent class is used to hide all the tabs content in the start
    jQuery('div.tab1').show(); // It will show the first tab content when page load, you can set any tab content you want - just put the tab content class e.g. tab4
    jQuery('div.htmltabs ul.tabs li.tab1 a').addClass('tab-current');// We will add the class to the current open tab to style the active state
    //It will add the click event on all the anchor tag under the htmltabs class to show the tab content when clicking to the tab
    jQuery('div.htmltabs ul li a').click(function()
    {
        var thisClass = this.className.slice(0,4);//"this" is the current anchor where user click and it will get the className from the current anchor and slice the first part as we have two class on the anchor
        jQuery('div.htmltabs div.tabsContent').hide();// It will hide all the tab content
        jQuery('div.' + thisClass).show(); // It will show the current content of the user selected tab
        jQuery('div.htmltabs ul.tabs li a').removeClass('tab-current');// It will remove the tab-current class from the previous tab to remove the active style
        jQuery(this).addClass('tab-current'); //It will add the tab-current class to the user selected tab
    });
});
</script>
{$stylesheets}
<script type="text/javascript">
<!--
    var cookieDomain = "{$mybb->settings['cookiedomain']}";
    var cookiePath = "{$mybb->settings['cookiepath']}";
    var cookiePrefix = "{$mybb->settings['cookieprefix']}";
    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 imagepath = "{$theme['imgdir']}";
// -->
</script>
{$newpmmsg}
Pewnie jest niewłaściwa kolejność.
https://webboard.pl/thread-36416.html?pi...#pid202847
Już sam nie wiem... Jeden działa, drugi nie działa i na odwrót.
Pomóżcie to ułożyć:
Kod:
<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->settings['bburl']}/jscripts/prototype.js?ver=1603"></script>
<script type="text/javascript" src="{$mybb->settings['bburl']}/jscripts/general.js?ver=1603"></script>
<script type="text/javascript" src="{$mybb->settings['bburl']}/jscripts/popup_menu.js?ver=1600"></script>
<script type="text/javascript" src="http://code.jquery.com/jquery-latest.js"></script>
<script type="text/javascript" src="{$mybb->settings['bburl']}/jscripts/jquery.leanModal.min.js"></script>
<script type="text/javascript" src="{$mybb->settings['bburl']}/jscripts/jquery.idTabs.min.js"></script>
<script type="text/javascript" src="{$mybb->settings['bburl']}/jscripts/jquery.jcarousel.min.js"></script>
<script type="text/javascript" src="{$mybb->settings['bburl']}/jscripts/jquery.js"></script>
<script type="text/javascript">jQuery.noConflict();</script>
<script type="text/javascript">
jQuery(function() {
jQuery('a[rel*=leanModal]').leanModal({ top : 200, closeButton: ".modal_close" });
});
</script>
<script type="text/javascript">
    jQuery(document).ready(function(){
     jQuery('#loged-toggle').click(function() {
      jQuery('#loged-content').slideToggle(300, function() {
      jQuery("#loged-toggle p").toggle();
      });
     });
    });
</script>
<script type="text/javascript">
jQuery(document).ready(function()
{
    jQuery('div.htmltabs div.tabsContent').hide();//tabsContent class is used to hide all the tabs content in the start
    jQuery('div.tab1').show(); // It will show the first tab content when page load, you can set any tab content you want - just put the tab content class e.g. tab4
    jQuery('div.htmltabs ul.tabs li.tab1 a').addClass('tab-current');// We will add the class to the current open tab to style the active state
    //It will add the click event on all the anchor tag under the htmltabs class to show the tab content when clicking to the tab
    jQuery('div.htmltabs ul li a').click(function()
    {
        var thisClass = this.className.slice(0,4);//"this" is the current anchor where user click and it will get the className from the current anchor and slice the first part as we have two class on the anchor
        jQuery('div.htmltabs div.tabsContent').hide();// It will hide all the tab content
        jQuery('div.' + thisClass).show(); // It will show the current content of the user selected tab
        jQuery('div.htmltabs ul.tabs li a').removeClass('tab-current');// It will remove the tab-current class from the previous tab to remove the active style
        jQuery(this).addClass('tab-current'); //It will add the tab-current class to the user selected tab
    });
});
</script>
{$stylesheets}
<script type="text/javascript">
<!--
    var cookieDomain = "{$mybb->settings['cookiedomain']}";
    var cookiePath = "{$mybb->settings['cookiepath']}";
    var cookiePrefix = "{$mybb->settings['cookieprefix']}";
    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 imagepath = "{$theme['imgdir']}";
// -->
</script>
<script type="text/javascript" src="{$mybb->settings['bburl']}/images/carbon/js/login.js"></script>
<script type="text/javascript" src="{$mybb->settings['bburl']}/jscripts/jcarousel.responsive.js"></script>
{$newpmmsg}
Kolejność nie ma aż takiego znaczenia (tylko pozycja noConflict i załadowania biblioteki), ale 2x jQuery już tak. Zamień na:
Kod:
<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="http://code.jquery.com/jquery-latest.js"></script>
<script type="text/javascript">jQuery.noConflict();</script>
<script type="text/javascript" src="{$mybb->settings['bburl']}/jscripts/prototype.js?ver=1603"></script>
<script type="text/javascript" src="{$mybb->settings['bburl']}/jscripts/general.js?ver=1603"></script>
<script type="text/javascript" src="{$mybb->settings['bburl']}/jscripts/popup_menu.js?ver=1600"></script>
<script type="text/javascript" src="{$mybb->settings['bburl']}/jscripts/jquery.leanModal.min.js"></script>
<script type="text/javascript" src="{$mybb->settings['bburl']}/jscripts/jquery.idTabs.min.js"></script>
<script type="text/javascript" src="{$mybb->settings['bburl']}/jscripts/jquery.jcarousel.min.js"></script>
<script type="text/javascript" src="{$mybb->settings['bburl']}/jscripts/jcarousel.responsive.js"></script>
<script type="text/javascript" src="{$mybb->settings['bburl']}/images/carbon/js/login.js"></script>
<script type="text/javascript">
jQuery(function() {
jQuery('a[rel*=leanModal]').leanModal({ top : 200, closeButton: ".modal_close" });
});
</script>
<script type="text/javascript">
    jQuery(document).ready(function(){
     jQuery('#loged-toggle').click(function() {
      jQuery('#loged-content').slideToggle(300, function() {
      jQuery("#loged-toggle p").toggle();
      });
     });
    });
</script>
<script type="text/javascript">
jQuery(document).ready(function()
{
    jQuery('div.htmltabs div.tabsContent').hide();//tabsContent class is used to hide all the tabs content in the start
    jQuery('div.tab1').show(); // It will show the first tab content when page load, you can set any tab content you want - just put the tab content class e.g. tab4
    jQuery('div.htmltabs ul.tabs li.tab1 a').addClass('tab-current');// We will add the class to the current open tab to style the active state
    //It will add the click event on all the anchor tag under the htmltabs class to show the tab content when clicking to the tab
    jQuery('div.htmltabs ul li a').click(function()
    {
        var thisClass = this.className.slice(0,4);//"this" is the current anchor where user click and it will get the className from the current anchor and slice the first part as we have two class on the anchor
        jQuery('div.htmltabs div.tabsContent').hide();// It will hide all the tab content
        jQuery('div.' + thisClass).show(); // It will show the current content of the user selected tab
        jQuery('div.htmltabs ul.tabs li a').removeClass('tab-current');// It will remove the tab-current class from the previous tab to remove the active style
        jQuery(this).addClass('tab-current'); //It will add the tab-current class to the user selected tab
    });
});
</script>
{$stylesheets}
<script type="text/javascript">
<!--
    var cookieDomain = "{$mybb->settings['cookiedomain']}";
    var cookiePath = "{$mybb->settings['cookiepath']}";
    var cookiePrefix = "{$mybb->settings['cookieprefix']}";
    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 imagepath = "{$theme['imgdir']}";
// -->
</script>
{$newpmmsg}

Poza tym widzę też 2x jcarousel i nie wiem czy to te same pliki, bo strona została zawieszona na jakże świetnym hostingu xaa. Zostawiłem, usuń jeśli to to samo albo coś bardzo podobnego.
Nie działa to do końca...
Zobaczcie: panel logowania się nie wysuwa; newsy na portalu prawie działają; okienko z polubieniami się nie chowa; http://new-generation.xaa.pl/showthread....=20&pid=27
A no tak.. Używane są przestarzałe funkcje jQuery, np. panel logowania wymaga live(), która została zdeprecjonowana w 1.7 (ponad 2 lata temu) i całkowicie usunięta w 1.9 (rok temu).

Zmień:
Kod:
<script type="text/javascript" src="http://code.jquery.com/jquery-latest.js"></script>
na jakiś starszy.
Jakieś propozycje?
Masz wyżej propozycje od Destroy666
Poszukaj starszej biblioteki