snipt

Ctrl+h for KB shortcuts

JavaScript

Get Window Size

var size = window.getSize();
alert(size.x);
https://snipt.net/embed/446181b7cbb2120ec1e7763169321f1d/
/raw/446181b7cbb2120ec1e7763169321f1d/
446181b7cbb2120ec1e7763169321f1d
js
JavaScript
2
2019-06-10T10:25:08
True
False
False
/api/public/snipt/2823/
get-window-size
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a> <a href="#L-2">2</a></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a><span class="kd">var</span> <span class="nx">size</span> <span class="o">=</span> <span class="nb">window</span><span class="p">.</span><span class="nx">getSize</span><span class="p">();</span> </span><span id="L-2"><a name="L-2"></a><span class="nx">alert</span><span class="p">(</span><span class="nx">size</span><span class="p">.</span><span class="nx">x</span><span class="p">);</span> </span></pre></div> </td></tr></table>
js, mootools

JavaScript

Mootools JavaScript Event

1
2
3
window.addEvent('domready', function() {

});
https://snipt.net/embed/7ef9634bd7b944b8d973ccd79131ddd9/
/raw/7ef9634bd7b944b8d973ccd79131ddd9/
7ef9634bd7b944b8d973ccd79131ddd9
js
JavaScript
3
2019-06-13T06:25:37
True
False
False
/api/public/snipt/2821/
mootools-javascript-event
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a> <a href="#L-2">2</a> <a href="#L-3">3</a></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a><span class="nb">window</span><span class="p">.</span><span class="nx">addEvent</span><span class="p">(</span><span class="s1">&#39;domready&#39;</span><span class="p">,</span> <span class="kd">function</span><span class="p">()</span> <span class="p">{</span> </span><span id="L-2"><a name="L-2"></a> </span><span id="L-3"><a name="L-3"></a><span class="p">});</span> </span></pre></div> </td></tr></table>
js, mootools

HTML

Include JavaScipt

<script type="text/javascript" src="mootools-1.2.1-core.js"></script>
https://snipt.net/embed/befec5dee3c32c0502a7ef9a3dab6f5c/
/raw/befec5dee3c32c0502a7ef9a3dab6f5c/
befec5dee3c32c0502a7ef9a3dab6f5c
html
HTML
1
2019-06-15T23:34:18
True
False
False
/api/public/snipt/2761/
include-javascipt
<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="p">&lt;</span><span class="nt">script</span> <span class="na">type</span><span class="o">=</span><span class="s">&quot;text/javascript&quot;</span> <span class="na">src</span><span class="o">=</span><span class="s">&quot;mootools-1.2.1-core.js&quot;</span><span class="p">&gt;&lt;/</span><span class="nt">script</span><span class="p">&gt;</span> </span></pre></div> </td></tr></table>
html, js

JavaScript

fix for console.log

1
2
3
if (typeof console.log != function) {
    console.log = function(){ /* ... */ } 
}
https://snipt.net/embed/5dd678e5fdffd61bb86199d8992f31ea/
/raw/5dd678e5fdffd61bb86199d8992f31ea/
5dd678e5fdffd61bb86199d8992f31ea
js
JavaScript
3
2019-06-13T04:48:10
True
False
False
/api/public/snipt/1232/
fix-for-consolelog
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a> <a href="#L-2">2</a> <a href="#L-3">3</a></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a><span class="k">if</span> <span class="p">(</span><span class="k">typeof</span> <span class="nx">console</span><span class="p">.</span><span class="nx">log</span> <span class="o">!=</span> <span class="err">‘</span><span class="kd">function</span><span class="err">’</span><span class="p">)</span> <span class="p">{</span> </span><span id="L-2"><a name="L-2"></a> <span class="nx">console</span><span class="p">.</span><span class="nx">log</span> <span class="o">=</span> <span class="kd">function</span><span class="p">(){</span> <span class="cm">/* ... */</span> <span class="p">}</span> </span><span id="L-3"><a name="L-3"></a><span class="p">}</span> </span></pre></div> </td></tr></table>
console.log, debug, firebug, javascript, js