mirror of
https://github.com/gitbucket/gitbucket.git
synced 2025-11-12 00:15:50 +01:00
Merge pull request #705 from team-lab/fix/word-diff-probrem
fix word-diff javascript error
This commit is contained in:
@@ -29,6 +29,9 @@ DAMAGE.
|
|||||||
***/
|
***/
|
||||||
/* Author: Chas Emerick <cemerick@snowtide.com> */
|
/* Author: Chas Emerick <cemerick@snowtide.com> */
|
||||||
__whitespace = {" ":true, "\t":true, "\n":true, "\f":true, "\r":true};
|
__whitespace = {" ":true, "\t":true, "\n":true, "\f":true, "\r":true};
|
||||||
|
function __hasOwnProperty(obj, target){
|
||||||
|
return Object.prototype.hasOwnProperty.call(obj, target);
|
||||||
|
}
|
||||||
|
|
||||||
difflib = {
|
difflib = {
|
||||||
defaultJunkFunction: function (c) {
|
defaultJunkFunction: function (c) {
|
||||||
@@ -93,7 +96,7 @@ difflib = {
|
|||||||
|
|
||||||
// replacement for python's dict.get function -- need easy default values
|
// replacement for python's dict.get function -- need easy default values
|
||||||
__dictget: function (dict, key, defaultValue) {
|
__dictget: function (dict, key, defaultValue) {
|
||||||
return dict.hasOwnProperty(key) ? dict[key] : defaultValue;
|
return __hasOwnProperty(dict, key) ? dict[key] : defaultValue;
|
||||||
},
|
},
|
||||||
|
|
||||||
SequenceMatcher: function (a, b, isjunk) {
|
SequenceMatcher: function (a, b, isjunk) {
|
||||||
@@ -122,7 +125,7 @@ difflib = {
|
|||||||
var populardict = {};
|
var populardict = {};
|
||||||
for (var i = 0; i < b.length; i++) {
|
for (var i = 0; i < b.length; i++) {
|
||||||
var elt = b[i];
|
var elt = b[i];
|
||||||
if (b2j.hasOwnProperty(elt)) {
|
if (__hasOwnProperty(b2j, elt)) {
|
||||||
var indices = b2j[elt];
|
var indices = b2j[elt];
|
||||||
if (n >= 200 && indices.length * 100 > n) {
|
if (n >= 200 && indices.length * 100 > n) {
|
||||||
populardict[elt] = 1;
|
populardict[elt] = 1;
|
||||||
@@ -151,7 +154,7 @@ difflib = {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (var elt in b2j) {
|
for (var elt in b2j) {
|
||||||
if (b2j.hasOwnProperty(elt) && isjunk(elt)) {
|
if (__hasOwnProperty(b2j, elt) && isjunk(elt)) {
|
||||||
junkdict[elt] = 1;
|
junkdict[elt] = 1;
|
||||||
delete b2j[elt];
|
delete b2j[elt];
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user