snipt

Ctrl+h for KB shortcuts

JavaScript

Clear CSS cache in Firefox bookmarklet

javascript:void(function(){var%20i,a,s;a=document.getElementsByTagName('link');for(i=0;i<a.length;i++){s=a[i];if(s.rel.toLowerCase().indexOf('stylesheet')>=0&&s.href)%20{var%20h=s.href.replace(/(&|%5C?)forceReload=d+/,'');s.href=h+(h.indexOf('?')>=0?'&':'?')+'forceReload='+(new%20Date().valueOf())}}})();
https://snipt.net/embed/6aeca59c5b12172f0ddadf09d40acd3c/
/raw/6aeca59c5b12172f0ddadf09d40acd3c/
6aeca59c5b12172f0ddadf09d40acd3c
js
JavaScript
1
2019-07-15T22:06:10
True
False
False
Aug 25, 2012 at 04:58 AM
/api/public/snipt/46283/
clear-css-cache-in-firefox-bookmarklet
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a><span class="nx">javascript</span><span class="o">:</span><span class="k">void</span><span class="p">(</span><span class="kd">function</span><span class="p">(){</span><span class="kd">var</span><span class="o">%</span><span class="mi">20</span><span class="nx">i</span><span class="p">,</span><span class="nx">a</span><span class="p">,</span><span class="nx">s</span><span class="p">;</span><span class="nx">a</span><span class="o">=</span><span class="nb">document</span><span class="p">.</span><span class="nx">getElementsByTagName</span><span class="p">(</span><span class="s1">&#39;link&#39;</span><span class="p">);</span><span class="k">for</span><span class="p">(</span><span class="nx">i</span><span class="o">=</span><span class="mi">0</span><span class="p">;</span><span class="nx">i</span><span class="o">&lt;</span><span class="nx">a</span><span class="p">.</span><span class="nx">length</span><span class="p">;</span><span class="nx">i</span><span class="o">++</span><span class="p">){</span><span class="nx">s</span><span class="o">=</span><span class="nx">a</span><span class="p">[</span><span class="nx">i</span><span class="p">];</span><span class="k">if</span><span class="p">(</span><span class="nx">s</span><span class="p">.</span><span class="nx">rel</span><span class="p">.</span><span class="nx">toLowerCase</span><span class="p">().</span><span class="nx">indexOf</span><span class="p">(</span><span class="s1">&#39;stylesheet&#39;</span><span class="p">)</span><span class="o">&gt;=</span><span class="mi">0</span><span class="o">&amp;&amp;</span><span class="nx">s</span><span class="p">.</span><span class="nx">href</span><span class="p">)</span><span class="o">%</span><span class="mi">20</span><span class="p">{</span><span class="kd">var</span><span class="o">%</span><span class="mi">20</span><span class="nx">h</span><span class="o">=</span><span class="nx">s</span><span class="p">.</span><span class="nx">href</span><span class="p">.</span><span class="nx">replace</span><span class="p">(</span><span class="sr">/(&amp;|%5C?)forceReload=d+/</span><span class="p">,</span><span class="s1">&#39;&#39;</span><span class="p">);</span><span class="nx">s</span><span class="p">.</span><span class="nx">href</span><span class="o">=</span><span class="nx">h</span><span class="o">+</span><span class="p">(</span><span class="nx">h</span><span class="p">.</span><span class="nx">indexOf</span><span class="p">(</span><span class="s1">&#39;?&#39;</span><span class="p">)</span><span class="o">&gt;=</span><span class="mi">0</span><span class="o">?</span><span class="s1">&#39;&amp;&#39;</span><span class="o">:</span><span class="s1">&#39;?&#39;</span><span class="p">)</span><span class="o">+</span><span class="s1">&#39;forceReload=&#39;</span><span class="o">+</span><span class="p">(</span><span class="k">new</span><span class="o">%</span><span class="mi">20</span><span class="nb">Date</span><span class="p">().</span><span class="nx">valueOf</span><span class="p">())}}})();</span> </span></pre></div> </td></tr></table>
bookmarklet, cache, css

JavaScript

Replace parts of current URL and go to it

javascript:(function() {var curloc = location.href; curloc = curloc.replace(/www/g,"cp");curloc = curloc.replace(/view/g,"edit"); location.href = curloc; })();
https://snipt.net/embed/a46bb815b13d7481c21ec93c46beae3c/
/raw/a46bb815b13d7481c21ec93c46beae3c/
a46bb815b13d7481c21ec93c46beae3c
js
JavaScript
1
2019-07-10T15:57:39
True
False
False
/api/public/snipt/43196/
replace-parts-of-current-url-and-go-to-it
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a><span class="nx">javascript</span><span class="o">:</span><span class="p">(</span><span class="kd">function</span><span class="p">()</span> <span class="p">{</span><span class="kd">var</span> <span class="nx">curloc</span> <span class="o">=</span> <span class="nx">location</span><span class="p">.</span><span class="nx">href</span><span class="p">;</span> <span class="nx">curloc</span> <span class="o">=</span> <span class="nx">curloc</span><span class="p">.</span><span class="nx">replace</span><span class="p">(</span><span class="sr">/www/g</span><span class="p">,</span><span class="s2">&quot;cp&quot;</span><span class="p">);</span><span class="nx">curloc</span> <span class="o">=</span> <span class="nx">curloc</span><span class="p">.</span><span class="nx">replace</span><span class="p">(</span><span class="sr">/view/g</span><span class="p">,</span><span class="s2">&quot;edit&quot;</span><span class="p">);</span> <span class="nx">location</span><span class="p">.</span><span class="nx">href</span> <span class="o">=</span> <span class="nx">curloc</span><span class="p">;</span> <span class="p">})();</span> </span></pre></div> </td></tr></table>
bookmarklet, javascript