Pārlūkot izejas kodu

use jquery unique

version-14
Anand Doshi pirms 12 gadiem
vecāks
revīzija
98b27fbaf6
4 mainītis faili ar 3 papildinājumiem un 19 dzēšanām
  1. +0
    -10
      public/js/legacy/utils/datatype.js
  2. +1
    -1
      public/js/legacy/widgets/form/print_format.js
  3. +1
    -7
      public/js/wn/misc/utils.js
  4. +1
    -1
      public/js/wn/model/workflow.js

+ 0
- 10
public/js/legacy/utils/datatype.js Parādīt failu

@@ -272,13 +272,3 @@ function roundNumber(num, dec) {
var result = Math.round(num*Math.pow(10,dec))/Math.pow(10,dec);
return result;
}

function filter_unique(list) {
var a = [], l = list.length;
for(var i=0; i<l; i++) {
for(var j=i+1; j<l; j++)
if (list[i] === list[j]) j = ++i;
a.push(list[i]);
}
return a;
};

+ 1
- 1
public/js/legacy/widgets/form/print_format.js Parādīt failu

@@ -374,7 +374,7 @@ $.extend(_p, {
// replace relative links by absolute links
var prefix = window.location.href.split("app.html")[0]
// find unique matches
var matches = filter_unique(finished.match(/src=['"]([^'"]*)['"]/g) || []);
var matches = $.unique(finished.match(/src=['"]([^'"]*)['"]/g) || []);
$.each(matches, function(i, v) {
if(v.substr(0,4)=="src=") {


+ 1
- 7
public/js/wn/misc/utils.js Parādīt failu

@@ -78,10 +78,4 @@ wn.utils = {
me.footnote_area = null;
}
},
};

var unique = function(a) {
return a.filter(function(item,i,a){
return i==a.indexOf(item);
});
}
};

+ 1
- 1
public/js/wn/model/workflow.js Parādīt failu

@@ -92,7 +92,7 @@ wn.workflow = {
return false;
},
get_update_fields: function(doctype) {
var update_fields = unique($.map(wn.model.get("Workflow Document State",
var update_fields = $.unique($.map(wn.model.get("Workflow Document State",
{parent:wn.workflow.workflows[doctype].name}), function(d) {
return d.update_field;
}));


Notiek ielāde…
Atcelt
Saglabāt