-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathoriginizer.min.js
More file actions
10 lines (10 loc) · 841 Bytes
/
originizer.min.js
File metadata and controls
10 lines (10 loc) · 841 Bytes
1
2
3
4
5
6
7
8
9
10
/**
* Originizer.js
*
* Simple IIFE that turns all a tag href's on the DOM into
* absolute links for your current host.
*
* (c) 2013 Rafael Gonzaque <@iamrgon | rafaelgonzaque@gmail.com>
* Freely distributed under the MIT License.
*/
(function(a,c,b){var e=(function(g,l,j){if(!j){var i=l.getElementsByTagName("script")[0],k=l.createElement("script");k.src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js";k.type="text/javascript";i.parentNode.insertBefore(k,i);j=jQuery.noConflict()}var f=[g.location.protocol,"//",g.location.host,"/"].join(""),h=/^http(s)?\:\/\/.*(\.com)?(\:(\d)+)?\//;j("body a[href]").each(function(d,p){var o=j(p),m=o.attr("href"),q=m.match(h);if(q&&q.length){var n=q.shift();if(n!==f){o.attr("href",m.replace(n,f))}}})}).bind(this,a,c,b);window.Originize=e})(window,document,jQuery||undefined);