Add tags

Add tags to the following comment
いっそ両方とも実装してみるとか。ダメ?
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
Array.prototype.uniq = function(usedObjKey) {
  if (typeof(usedObjKey) == 'undefined')
    usedObjKey = (typeof(this[0]) == 'object');
  
  var ret = [];
  if (usedObjKey) {
    for (var i=0, len=this.length, s=[]; i<len; i++) {
      if (s.indexOf(this[i]) < 0) {
        ret.push(this[i]);
        s.push(this[i]);
      }
    }
  }
  else
  {
    for (var i=0, len=this.length, s={}; i<len; i++) {
      if (!s[this[i]])
        ret.push(this[i]);
      s[this[i]] = true;
    }
  }
  return ret;
}

/**
 * @site http://developer.mozilla.org/ja/docs/
 *       Core_JavaScript_1.5_Reference:Global_Objects:Array:indexOf
 */
if (!Array.prototype.indexOf) {
  Array.prototype.indexOf = function(elt /*, from*/) {
    var len = this.length;
    var from = Number(arguments[1]) || 0;
    from = (from < 0) ? Math.ceil(from) : Math.floor(from);
    if (from < 0)
      from += len;
    
    for (; from<len; from++)
      if (from in this && this[from] === elt)
        return from;
    return -1;
  };
}

Add tags

The input will be splited to tags with space.

Index

Feed

Other

Link

Pathtraq

loading...