Skip to content
This repository
Browse code

Added common.js

  • Loading branch information...
commit 05079e760b7bdd0ba0a8fadd298924422b6d07ba 1 parent c32984a
Denis Olshin authored

Showing 1 changed file with 19 additions and 0 deletions. Show diff stats Hide diff stats

  1. +19 0 js/common.js
19 js/common.js
... ... @@ -0,0 +1,19 @@
  1 +String.prototype.trim = function() {
  2 + var i = 0;
  3 + while (i < this.length && (this.charAt(i) == " " || this.charAt(i) == "\n" || this.charAt(i) == "\r" || this.charAt(i) == "\t")) i++;
  4 + var j = this.length - 1;
  5 + while (j >= 0 && (this.charAt(j) == " " || this.charAt(j) == "\n" || this.charAt(j) == "\r" || this.charAt(j) == "\t")) j--;
  6 + return this.substr(i, j - i + 1);
  7 +}
  8 +Array.prototype.indexOf = function(v) {
  9 + for (var i = 0; i < this.length; i++)
  10 + if (this[i] == v)
  11 + return i;
  12 + return -1;
  13 +}
  14 +function wrapAs(s, c) {
  15 + return "<span class='" + c + "'>" + s + "</span>";
  16 +}
  17 +function ge(e) {
  18 + return document.getElementById(e);
  19 +}

0 comments on commit 05079e7

Please sign in to comment.
Something went wrong with that request. Please try again.