מדיה ויקי:Gadget-directlink-to-commons.js
קפיצה לניווט
קפיצה לחיפוש
הערה: לאחר השמירה, ייתכן שיהיה צורך לנקות את זיכרון המטמון (cache) של הדפדפן כדי להבחין בשינויים.
- פיירפוקס / ספארי: להחזיק את המקש Shift בעת לחיצה על טעינה מחדש (Reload), או ללחוץ על צירוף המקשים Ctrl-F5 או Ctrl-R (במחשב מק: ⌘-R).
- גוגל כרום: ללחוץ על צירוף המקשים Ctrl-Shift-R (במחשב מק: ⌘-Shift-R).
- אינטרנט אקספלורר: להחזיק את המקש Ctrl בעת לחיצה על רענן (Refresh), או ללחוץ על צירוף המקשים Ctrl-F5.
- אופרה: לפתוח תפריט ← הגדרות (במחשב מק: Opera ← העדפות) ואז ללחוץ על פרטיות ואבטחה ← מחק היסטוריית גלישה ← Cached images and files.
/** * Direct imagelinks to Commons * * @source mediawiki.org/wiki/Snippets/Direct_imagelinks_to_Commons * @author [[commons:User:Krinkle]] * @version 9 */ if ( mw.config.get( 'wgNamespaceNumber', 0 ) >= 0 ) { $( function () { var uploadBaseRe = /^\/\/upload\.wikimedia\.org\/wikipedia\/commons/, localBasePath = mw.util.getUrl( mw.config.get( 'wgFormattedNamespaces' )['6'] + ':' ), localBaseScript = mw.util.wikiScript() + '?title=' + mw.util.wikiUrlencode( mw.config.get( 'wgFormattedNamespaces' )['6'] + ':' ), commonsBasePath = '//commons.wikimedia.org/wiki/File:', commonsBaseScript = '//commons.wikimedia.org/w/index.php?title=File:'; $( 'a.image' ).attr( 'href', function ( i, currVal ) { if ( uploadBaseRe.test( $(this).find( 'img' ).attr( 'src' ) ) ) { return currVal .replace( localBasePath, commonsBasePath ) .replace( localBaseScript, commonsBaseScript ); } }); }); }