משתמש:ויקיג'אנקי/comment listings.js
הערה: לאחר הפרסום, ייתכן שיהיה צורך לנקות את זיכרון המטמון (cache) של הדפדפן כדי להבחין בשינויים.
- פיירפוקס / ספארי: להחזיק את המקש Shift בעת לחיצה על טעינה מחדש (Reload) או ללחוץ על צירוף המקשים Ctrl-F5 או Ctrl-R (במחשב מק: ⌘-R).
- גוגל כרום: ללחוץ על צירוף המקשים Ctrl-Shift-R (במחשב מק: ⌘-Shift-R).
- אינטרנט אקספלורר / אדג': להחזיק את המקש Ctrl בעת לחיצה על רענן (Refresh) או ללחוץ על צירוף המקשים Ctrl-F5.
- אופרה: ללחוץ על Ctrl-F5.
function check_queryString(p) {
var re = RegExp('[&?]' + p + '=([^&]*)');
var matches;
if (matches = re.exec(document.location)) {
try {
return decodeURI(matches[1]);
} catch (e) { }
}
return null;
}
if(mw.config.get('wgNamespaceNumber') == 2) {
$( function flagEditButton() {
mw.util.addPortletLink('p-cactions',
mw.util.getUrl(null,{action:'edit',commentlistings:true}),
'comment listings',
'p-commentlistings',
'commentlistings edit');
})
}
if(mw.config.get('wgAction') == 'edit' && check_queryString('commentlistings') == 'true') {
var myContent = document.getElementById('wpTextbox1').value;
myContent = myContent.replace(/(hours|directions|price|checkin|checkout|content)\=([^\|\{\}]*) \|/g,'$1\=<!-- $2 --> \|');
myContent = myContent.replace(/(hours|directions|price|checkin|checkout|content)\=([^\|\{\}]*)\n\|/g,'$1\=<!-- $2 -->\n\|');
myContent = myContent.replace(/(hours|directions|price|checkin|checkout|content)\=([^\|\{\}]*)\}\}/g,'$1\=<!-- $2 -->\n\}\}');
myContent = myContent.replace(/\<\!\-\- *\-\-\>/g,'');
if (myContent != document.getElementById('wpTextbox1').value) {
document.getElementById('wpTextbox1').value=myContent;
document.getElementById('wpSummary').value='comment out listings for translation';
}
}