1. Hello Guest, selamat datang di Forum WinPoin. Kamu bisa bertanya, berdiskusi, sharing, dan ngobrolin apapun seputar Windows, Windows Phone, PC, Gadget, atau hal seputar Teknologi lainnya. Selamat berkomunitas! ;)

Cara Atasi Konflik Javascript Prototype dengan Bootstrap

Discussion in 'Developer Corner' started by Yusril Ibnu, Jun 11, 2014.

  1. Yusril Ibnu

    Yusril Ibnu Winpoin Staff Staff Member

    Joined:
    May 12, 2014
    Messages:
    6,353
    Permisi, ada masalah js, begini ceritanya...
    saat saya membuat template MYBB, mengiginkannya responsive saya memakai framework bootsrap, termasuk javascriptnya, tapi telah kita tau bahwa MYBB memakai Javascript Prototype sebagai javascript text editornya, otomatis saya harus memasang dua duanya..

    Berikutlah template headerinclude-nya

    Code:
    {$stylesheets}
    <link rel="stylesheet" href="yumy-themes/css/bootstrap.min.css"/>
    <link rel="stylesheet" href="yumy-themes/css/bootstrap-theme.min.css"/>
    <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}" />
    <script type="text/javascript" src="yumy-themes/js/jquery.min.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="yumy-themes/js/bootstrap.min.js"></script>
    <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}
    yang jadi masalah ternyata javascript Prototype dengan Bootstrap-nya konflik
    <script type="text/javascript" src="yumy-themes/js/bootstrap.min.js"></script>
    <script type="text/javascript" src="{$mybb->settings['bburl']}/jscripts/prototype.js?ver=1603"></script>


    sedangkan saya memasang navbar bootsrap...
    jika js bootsrap dimatikan, lancar text editornya, cuma bermasalah untuk navbar
    jika js protype dimatikan, lancar navbarnya, text editornya gk keluar
    jika kedua js ada, text editor muncul, navbar bermasalah
    :tidaak1:
    yang saya inginkan lancar dua duanya...

    padahal sudah pake jquery no conflict
    Code:
    <script type='text/javascript'>jQuery.noConflict();</script>
    tapi gk ngaruh...

    jadi harus bagaimana Cara Atasi Konflik Javascript Prototype dengan Bootstrap ? :bingung:
    tolong bantuanya... :kagum:
    Terimakasih
     
  2. Ambrizal Suryadinata

    Ambrizal Suryadinata Saya Ganteng Staff Member

    Joined:
    Jan 25, 2014
    Messages:
    2,587
    http://getbootstrap.com/javascript/#js-noconflict
     
  3. Chrisnado

    Chrisnado Administrator Staff Member

    Joined:
    May 7, 2013
    Messages:
    1,862
    nah itu sama om sabuncolek udah dikasih :kagum:

    Code:
     
    
    var bootstrapButton = $.fn.button.noConflict() // return $.fn.button to previously assigned value
    $.fn.bootstrapBtn = bootstrapButton            // give $().bootstrapBtn the Bootstrap functionality
    
    
     
  4. Jazz

    Jazz Super Moderatór Staff Member

    Joined:
    Jan 6, 2014
    Messages:
    14,731
    Icha gak Ikut2an deh...
    Code:
    <script src="jquery.js"></script>
    <script src="jquery.autocomplete.js"></script>
    <script>
      jQuery.noConflict();
      jQuery(document).ready(function($){
        $("#example").autocomplete(options);
      });
    </script>
    <script src="prototype.js"></script>
    <script src="effects.js"></script>
    <script src="accordion.js"></script>
    Maaf Yuzzzzzzzzz
    :nangis1:
     
  5. Febian

    Febian Administrator Staff Member

    Joined:
    May 7, 2013
    Messages:
    8,032
    Lagi bikin project MyBB?
    Aku sarankan dipending aja..MyBB 1.8 udah di *hampir* dirilis
    Project redesign ku juga aku pending sampe 1.8 rilis

    Maen2 dulu sama versi beta nya disini

    Di MyBB 1.8 Prototype udah digantikan sm jQuery

    Kl utk solusi di permasalahan yang ini, langsung aja kunjungi link dari om SabunColek diatas :kagum:
     
  6. Yusril Ibnu

    Yusril Ibnu Winpoin Staff Staff Member

    Joined:
    May 12, 2014
    Messages:
    6,353
    jadinya begini kan ?

    Code:
    <script type='text/javascript'>
    
    var bootstrapButton = $.fn.button.noConflict() // return $.fn.button to previously assigned value
    $.fn.bootstrapBtn = bootstrapButton            // give $().bootstrapBtn the Bootstrap functionality
    
    </script>
    gak ngaruh..., masalahnya pada navbar...

    [​IMG]

    :cool:

    wah benar kah??? good news... :kagum:
    tapi saya mau oprek oprek aja dulu....
    pengen bisa solved dulu... :kagum:
    tapi bikin :woa:
     
  7. Ambrizal Suryadinata

    Ambrizal Suryadinata Saya Ganteng Staff Member

    Joined:
    Jan 25, 2014
    Messages:
    2,587
    wah iya yuzz ngapain lagi developer tema MyBB :ketawa:
    MyBB 1.8 mau dirilis dan sudah support full jQuery.

    kalau cara ku gak bisa pake caranya icha dan biasanya itu berhasil coba aja kamu liat struktur javascriptnya di forum winpoin.
     
  8. Yusril Ibnu

    Yusril Ibnu Winpoin Staff Staff Member

    Joined:
    May 12, 2014
    Messages:
    6,353
    memang kapan kira kira releasenya ? :kagum:

    gak bisa menerapkanya... :woa:
     
  9. Febian

    Febian Administrator Staff Member

    Joined:
    May 7, 2013
    Messages:
    8,032
    Summer tahun ini
    Mungkin sekitar bulan agustus
    Maenan sm beta nya dl biar familiar..daripada ntar 1.8 release redesign lagi..sebaiknya nunggu 1.8 dl, atau maenan sama beta nya dl :goodjob:
     
  10. Jazz

    Jazz Super Moderatór Staff Member

    Joined:
    Jan 6, 2014
    Messages:
    14,731
    Beta 1
    Bener kog, bisa Conversiin Prototype ke jQuery
     
  11. Ambrizal Suryadinata

    Ambrizal Suryadinata Saya Ganteng Staff Member

    Joined:
    Jan 25, 2014
    Messages:
    2,587
    Katanya tahun ini.

    Jangan keras-keras :ketawa:
     
  12. Yusril Ibnu

    Yusril Ibnu Winpoin Staff Staff Member

    Joined:
    May 12, 2014
    Messages:
    6,353
    berarti mending nunggu yg 1.8 ya ?

    klo kita buat themes 1.8 beta apakah akan jalan di 1.8 yg stable nanti :bingung:
    dan satu lagi ada link download beta-nya ?
    :kagum:
     
  13. Jazz

    Jazz Super Moderatór Staff Member

    Joined:
    Jan 6, 2014
    Messages:
    14,731
    Nihhh
    http://resources.mybb.com/downloads/18/beta/MyBB%201.8%20Beta%201.zip
    Jgn di Masukin Server Aktual ya...
    wkwkwkw
    :ketawa:
     
  14. Yusril Ibnu

    Yusril Ibnu Winpoin Staff Staff Member

    Joined:
    May 12, 2014
    Messages:
    6,353
    oke deh.. thx...


    =======SOLVED========
     

Share This Page