Skip to content

patridge/lodashify

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 

Repository files navigation

#lodashify v1.0.0

Want an easy way to poke at a page with Lo-Dash [compat-dev v.1.0.0]?

Create a bookmark with this for the URL (sorry, embedding the bookmarklet didn't work):

javascript:(function(){var%20el=document.createElement(%22div%22),b=document.getElementsByTagName(%22body%22)[0],otherlib=false,msg=%22%22;el.style.position=%22fixed%22;el.style.height=%2232px%22;el.style.width=%22220px%22;el.style.marginLeft=%22-110px%22;el.style.top=%220%22;el.style.left=%2250%25%22;el.style.padding=%225px%2010px%22;el.style.zIndex=1001;el.style.fontSize=%2212px%22;el.style.color=%22%23222%22;el.style.backgroundColor=%22%23f99%22;if(typeof%20_!=%22undefined%22){msg=%22This%20page%20already%20using%20Lo-Dash%20v%22+_.VERSION;return%20showMsg()}else%20if(typeof%20_==%22function%22)otherlib=true;function%20getScript(url,success){var%20script=document.createElement(%22script%22);script.src=url;var%20head=document.getElementsByTagName(%22head%22)[0],done=false;script.onload=script.onreadystatechange=function(){if(!done%26%26(!this.readyState||this.readyState==%22loaded%22||this.readyState==%22complete%22)){done=true;success();script.onload=script.onreadystatechange=null;head.removeChild(script)}};head.appendChild(script)}getScript(%22http://cdnjs.cloudflare.com/ajax/libs/lodash.js/1.0.0/lodash.compat.js%22,function(){if(typeof%20_==%22undefined%22)msg=%22Sorry,%20but%20Lo-Dash%20wasn't%20able%20to%20load%22;else{msg=%22This%20page%20is%20now%20Lo-Dashified%20with%20v%22+_.VERSION;if(otherlib)msg+=%22%20and%20noConflict().%20Use%20lodash(),not%20_().%22}return%20showMsg()});function%20showMsg(){el.innerHTML=msg;b.appendChild(el);window.setTimeout(function(){if(typeof%20_==%22undefined%22)b.removeChild(el);else{b.removeChild(el);if(otherlib)lodash=_.noConflict()}},2500)}})();

##References

Stolen Adapted from Karl Swedberg's jQuerify bookmarklet.

Final bookmarklet generated by running things through Closure Compiler and Bookmarkleter.

##License

MIT license. If you do something cool with it, though, I'd love to hear about it.

About

Bookmarklet to add Lo-Dash to a web page.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published