前端 網頁添加jquery、lodash等模塊方法


  1. chrome書簽欄
#網頁添加jquery
javascript:(function(){script=document.createElement('script');script.src='https://cdn.bootcss.com/jquery/3.2.1/jquery.min.js';document.body.appendChild(script);console.log($.fn.jquery);})();


#隱藏博客園博客的目錄
javascript:(function(){document.getElementById("sideToolbar").style.display ='none';})();

http://www.ruanyifeng.com/blog/2011/06/a_guide_for_writing_bookmarklet.html

  1. 使用console-importer
    https://github.com/pd4d10/console-importer
$i('lodash')   #添加lodash
$i('jquery')   #添加jquery


<script type="text/javascript">
    _([1, 2]).forEach(function(value) {
        console.log(value);
    });
    _.forEach([1, 3] , function(value, key) {
        console.log(key,value);
    });
</script>
'''
1
2
0 1
1 3
'''

_.forEach() 使用說明
https://www.jianshu.com/p/01f8b18ea2ae


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM