Skip to content

Commit

Permalink
better path handling
Browse files Browse the repository at this point in the history
  • Loading branch information
Jonathan Roig authored and Jonathan Roig committed Jul 26, 2017
1 parent 280b3d4 commit 2e0c832
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion emojiurlifier.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 4 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
var emojiurlifier = function (emojiDomain, standardDomain) {
console.log('Emoji Domain Progressive Enhancement by https://i❤️.ws')
console.log('Emoji Domain Progressive Enhancement by https://i❤️.ws');
console.log('Learn more at https://github.com/jonroig/emojiurlifier');

var wl = window.location;
var useEmojiDomain = /^((?!chrome).)*safari/i.test(navigator.userAgent);
if (navigator.userAgent.indexOf('CriOS') > -1) {
Expand All @@ -8,13 +10,13 @@ var emojiurlifier = function (emojiDomain, standardDomain) {
var currentUrl = wl.protocol + '//' + wl.hostname;

var outputUrl = useEmojiDomain ? emojiDomain : standardDomain;
console.log(currentUrl, outputUrl);
if (currentUrl === outputUrl) {
return;
}
if (wl.port) {
outputUrl += ':'+wl.port;
}
outputUrl += wl.pathname;
outputUrl += wl.search;
window.location = outputUrl;
}

0 comments on commit 2e0c832

Please sign in to comment.