title: Combine two bookmarklets that changes url AND removes parameters
body: <p>I'm trying to combine two bookmarklets into one so that it</p>
  
  <ol>
  <li><p>Removes all url parameters (if any)</p></li>
  <li><p>Redirects from one url to a sub domain.</p></li>
  </ol>
  
  <p>Example:</p>
  
  <p>From </p>
  
  <p><a href="http://www.justsomeurl.com" rel="nofollow noreferrer">http://www.justsomeurl.com</a><strong>/cat/article123</strong>?umt=sometimes-theres-a-parameter</p>
  
  <p>To </p>
  
  <p><a href="http://cms.justsomeurl.com/.admin/something/" rel="nofollow noreferrer">http://cms.justsomeurl.com/.admin/something/</a><strong>cat/article123</strong></p>
  
  <p>I have two separate bookmarklets that does this but I haven't managed to combine them. </p>
  
  <pre><code>javascript:location.href = location.href.substring(0,location.href.lastIndexOf("?"));
  </code></pre>
  
  <p>and </p>
  
  <pre><code>javascript:(function() {window.location=window.location.toString().replace(/^https:\/\/www\.justsomeurl.com/,'http://cms.justsomeurl.com/.admin/');})()
  </code></pre>
  
  <p>I suspect a delay is needed between step 1 and 2.</p>
  
  <p>I have tried this (and many combos) but it seems only the second function is picked up:</p>
  
  <pre><code>javascript: 
      function removeParameter(){ location.href = location.href.substring(0,location.href.lastIndexOf("?"));} ;
  
  (function replace() {window.location=window.location.toString().replace(/^https:\/\/www\.justsomeurl.com/,'http://cms.justsomeurl.com/.admin/');})(); 
  </code></pre>
  
  <p>Any help is appreciated! Thanks!</p>