मीडियाविकि:Common.js

अराइज़पीडिया से
Arisepedia (वार्ता | योगदान) द्वारा परिवर्तित १३:५९, १२ अक्टूबर २०२५ का अवतरण

ध्यान दें: प्रकाशित करने के बाद बदलाव देखने के लिए आपको अपने ब्राउज़र के कैश को हटाना पड़ सकता है।

  • Firefox/Safari: Reload क्लिक समय Shift दबाएँ, या फिर Ctrl-F5 या Ctrl-R दबाएँ (Mac पर ⌘-R)
  • Google Chrome: Ctrl-Shift-R दबाएँ (Mac पर ⌘-Shift-R)
  • Internet Explorer/Edge: Refresh पर क्लिक करते समय Ctrl दबाएँ, या Ctrl-F5 दबाएँ
  • Opera: Ctrl-F5 दबाएँ।
/* यहाँ दी गई जावास्क्रिप्ट सभी सदस्यों के लिए हमेशा लोड की जाएगी */
/* Any JavaScript here will be loaded for all users on every page load. */
// Public-only copy deterrent; admins/editors unaffected
(function () {
  var action = mw.config.get('wgAction'); // 'view', 'edit', etc.
  var groups = mw.config.get('wgUserGroups') || [];

  // Define who should be exempt (enable/trim as you like)
  var isPrivileged =
    groups.includes('sysop') ||
    groups.includes('bureaucrat') ||
    groups.includes('interface-admin') ||
    groups.includes('editor') ||       // remove if you don't have this group
    groups.includes('patroller');      // remove if you don't use this

  // Run only on read/view pages and only for non-privileged users
  if (action !== 'view' || isPrivileged) return;

  // Mark page so CSS activates only for these users
  document.documentElement.classList.add('no-copy');

  // Disable right-click (admins are exempt above)
  document.addEventListener('contextmenu', function (e) {
    e.preventDefault();
  }, { capture: true });

  // Prevent starting a selection (keeps links clickable)
  document.addEventListener('selectstart', function (e) {
    // Allow in fields/editable areas just in case
    var t = e.target;
    var tag = (t.tagName || '').toLowerCase();
    if (tag === 'input' || tag === 'textarea' || t.isContentEditable || (t.closest && t.closest('#wpTextbox1'))) {
      return;
    }
    e.preventDefault();
  }, { capture: true });

  // Block double/triple click selection
  document.addEventListener('mousedown', function (e) {
    // left/right clicks still work; we only block multi-click selection
    if (e.detail > 1) e.preventDefault();
  }, { capture: true });
})();