chrome.tabs.onUpdated.addListener(function(id, details, tab) {
  var url = tab.url;

  /**
   * Check if an array or string contains string
   *
   * @param  {Str|Arr} haystack
   * @param  {Str}     needle
   *
   * @return {Bool}
   */
  var contains = function(haystack, needle) {
    return haystack.indexOf(needle) !== -1;
  };

  /**
   * Check if current page contains source code
   *
   * @param  {Str} url
   *
   * @return {Bool}
   */
  var isSourcePage = function(url) {

    if (contains(url, "github.com")) {
      return contains(url, "/blob/") || contains(url, "/commit/");
    }

    if (contains(url, "bitbucket.org")) {
      return contains(url, "fileviewer=file-view-default") || (contains(url, "/commits/") && !contains(url, "/commits/all"));
    }

    return false;
  };

  chrome.storage.sync.get("tabSize", function(items) {
    var tabSpacing = encodeURI("ts=" + items.tabSize);

    if (contains(url, tabSpacing) || !isSourcePage(url)) {
      return;
    }

    var hashStart   = contains(url, "#") ? url.indexOf("#") : url.length;
    var querySymbol = contains(url, "?") ? "&" : "?";
    var newURL      = url.substring(0, hashStart) + querySymbol + tabSpacing + url.substring(hashStart);

    chrome.tabs.update(id, {
      url: "javascript:location.replace('" + newURL + "')"
    });
  });
});

@@ -1,530 +1,176 @@
 c
-hrome.tabs.onUpdated.addListener(function(id, details, tab) %7B%0A  var url = tab.url;%0A%0A  /**%0A   * Check if an array or string contains string%0A   *%0A   * @param  %7BStr%7CArr%7D haystack%0A   * @param  %7BStr%7D     needle%0A   *%0A   * @return %7BBool%7D%0A   */%0A  var contains = function(haystack, needle) %7B%0A    return haystack.indexOf(needle) !== -1;%0A  %7D;%0A%0A  /**%0A   * Check if current page contains source code%0A   *%0A   * @param  %7BStr%7D url%0A   *%0A   * @return %7BBool%7D%0A   */%0A  var isSourcePage = function(url) %7B%0A%0A    if (contains(url, %22github.com%22
+onst isSourcePage = url =%3E %7B%0A  if (url.includes('github.com')) %7B%0A    return url.includes('/blob/') %7C%7C url.includes('/commit/')%0A  %7D%0A%0A  if (url.includes('bitbucket.org'
 )) %7B%0A
-  
     
@@ -180,266 +180,231 @@
 urn 
-contains(url, %22/blob/%22) %7C%7C contains(url, %22/commit/%22);%0A    %7D%0A%0A    if (contains(url, %22bitbucket.org%22)) %7B%0A      return contains(url, %22fileviewer=file-view-default%22) %7C%7C (contains(url, %22/commits/%22) && !contains(url, %22/commits/all%22));%0A    %7D%0A%0A    return false;%0A  %7D;
+(url.includes('/commits/') && !url.includes('/commits/all')) %7C%7C%0A            url.includes('fileviewer=file-view-default')%0A  %7D%0A%0A  return false%0A%7D%0A%0Achrome.tabs.onUpdated.addListener((id, details, tab) =%3E %7B%0A  const url = tab.url
 %0A%0A  
@@ -431,17 +431,17 @@
 get(
-%22
+'
 tabSize
-%22
+'
 , fu
@@ -464,43 +464,83 @@
     
-var tabSpacing = encodeURI(%22ts=%22 + 
+if (!isSourcePage(url)) %7B%0A      return%0A    %7D%0A%0A    const queryParam = %60ts=$%7B
 item
@@ -548,19 +548,18 @@
 .tabSize
-);%0A
+%7D%60
 %0A    if 
@@ -563,54 +563,31 @@
 if (
-contains(url, tabSpacing) %7C%7C !isSourcePage(url
+url.includes(queryParam
 )) %7B
@@ -599,17 +599,16 @@
   return
-;
 %0A    %7D%0A%0A
@@ -611,19 +611,21 @@
  %7D%0A%0A    
-var
+const
  hashSta
@@ -631,29 +631,26 @@
 art 
-  = contains(url, %22#%22
+= url.includes('#'
 ) ? 
@@ -665,11 +665,11 @@
 xOf(
-%22#%22
+'#'
 ) : 
@@ -678,25 +678,26 @@
 l.length
-;
 %0A    
-var
+const
  querySy
@@ -707,89 +707,130 @@
 l = 
-contains(url, %22?%22) ? %22&%22 : %22?%22;%0A    var newURL      = url.substring(0, hashStart)
+url.includes('?') ? '&' : '?'%0A    const oldURL = encodeURIComponent(url.substring(0, hashStart))%0A    const newURL = oldURL
  + q
@@ -846,18 +846,18 @@
 l + 
-tabSpacing
+queryParam
  + u
@@ -879,17 +879,16 @@
 shStart)
-;
 %0A%0A    ch
@@ -921,17 +921,17 @@
    url: 
-%22
+%60
 javascri
@@ -955,40 +955,32 @@
 ce('
-%22 + 
+$%7B
 newURL
- + %22')%22
+%7D')%60
 %0A    %7D)
-;
 %0A  %7D)
-;
 %0A%7D)
-;
 %0A

fix issue where some urls were not properly escaped