Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Removed redundant util.js

  • Loading branch information...
commit fdaf26a81f97cc9f4cc98051d253cf8ff727828c 1 parent 2afb383
@LeaVerou authored
Showing with 0 additions and 74 deletions.
  1. +0 −72 code/util.js
  2. +0 −1  index-php.php
  3. +0 −1  index.html
View
72 code/util.js
@@ -1,72 +0,0 @@
-/**
- * Helper functions
- */
-String.prototype.splice = function(i, remove, add) {
- remove = +remove || 0;
- add = add || '';
-
- return this.slice(0,i) + add + this.slice(i + remove);
-};
-
- function offset(element) {
- var left = 0, top = 0, el = element;
-
- if (el.parentNode) {
- do {
- left += el.offsetLeft - el.scrollLeft;
- top += el.offsetTop - el.scrollTop;
- } while ((el = el.parentNode) && el.nodeType < 9);
- }
-
- return {
- top: top,
- right: innerWidth - left - element.offsetWidth,
- bottom: innerHeight - top - element.offsetHeight,
- left: left,
- };
-}
-
-function xhr(o) {
- document.body.setAttribute('data-loading', '');
-
- var xhr = new XMLHttpRequest(),
- method = o.method || 'GET',
- data = o.data || '';
-
- xhr.open(method, o.url + (method === 'GET' && data? '?' + data : ''), true);
-
- if(method !== 'GET') {
- xhr.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
- }
-
- if(o.headers) {
- for(var header in o.headers) {
- xhr.setRequestHeader(header, o.headers[header]);
- }
- }
-
- xhr.onreadystatechange = function(){
- if(xhr.readyState === 4) {
- document.body.removeAttribute('data-loading');
-
- if(xhr.responseText) {
- o.callback(xhr);
- }
- }
- };
-
- xhr.send(method === 'GET'? null : data);
-
- return xhr;
-}
-
-function script(url, callback, doc) {
- doc = doc || document;
-
- var script = doc.createElement('script');
- script.src = url;
- script.async = true;
- doc.documentElement.appendChild(script);
-
- script.onload = callback;
-}
View
1  index-php.php
@@ -162,7 +162,6 @@
<div id="url" class="previewer"><img src="data:," alt="Loading…" /></div>
<div id="entity" class="previewer"></div>
-<script src="/code/util.js"></script><!-- to be removed -->
<script src="/code/utopia.js"></script>
<script src="/code/selection.js"></script>
<script src="/code/prism.js"></script>
View
1  index.html
@@ -169,7 +169,6 @@
<div id="url" class="previewer"><img src="data:," alt="Loading…" /></div>
<div id="entity" class="previewer"></div>
-<script src="/code/util.js"></script><!-- to be removed -->
<script src="/code/utopia.js"></script>
<script src="/code/selection.js"></script>
<script src="/code/prism.js"></script>
Please sign in to comment.
Something went wrong with that request. Please try again.