מדיה ויקי:Gadget-pgnviewer.js: הבדלים בין גרסאות בדף
. |
יותר מדויק |
||
| שורה 344: | שורה 344: | ||
try { | try { | ||
var regex = new RegExp('(' + Object.keys(piece).join("|") + ')'); | var regex = new RegExp('(' + Object.keys(piece).join("|") + ')'); | ||
notation = notation.replace(regex, function(c) { return piece[c]; } ); | notation = notation.replace(regex, function(c) { return piece[c] || c; } ); | ||
} catch (e) { | } catch (e) { | ||
mw.log('bad config.translate.pieces'); | mw.log('bad config.translate.pieces'); | ||
| שורה 353: | שורה 353: | ||
if (file) { | if (file) { | ||
try { | try { | ||
notation = notation.replace(/[abcdefgh]/g, function(c) { return file[c]; } ); | notation = notation.replace(/[abcdefgh]/g, function(c) { return file[c] || c; } ); | ||
} catch (e) { | } catch (e) { | ||
mw.log('bad config.translate.file'); | mw.log('bad config.translate.file'); | ||
| שורה 361: | שורה 361: | ||
if (row) { | if (row) { | ||
try { | try { | ||
notation = notation.replace(/[12345678]/g, function(c) { return row[c]; } ); | notation = notation.replace(/[12345678]/g, function(c) { return row[c] || c; } ); | ||
} catch (e) { | } catch (e) { | ||
mw.log('bad config.translate.row'); | mw.log('bad config.translate.row'); | ||