వాడుకరి:Pavan santhosh.s/common.js

వికీపీడియా నుండి
(వాడుకరి:Pavan santhosh.s/commons.js నుండి దారిమార్పు చెందింది)
Jump to navigation Jump to search

గమనిక: భద్రపరచిన తరువాత, మార్పులను చూడాలంటేమీ బ్రౌజరు కాషె ను తప్పించవలసి రావచ్చు. మొజిల్లా/ ఫైర్‌ఫాక్స్‌/ సఫారి: shift కీని నొక్కి పెట్టి Reload నొక్కండి, లేదా Ctrl-shift-R నొక్కండి (యాపుల్‌ మాక్‌ లో Cmd-shift-R); IE: Ctrl నొక్కి పెట్టి, Refresh నొక్కండి, లేదా Ctrl-F5 నొక్కండి; కాంకరర్‌:: Reload మీట నొక్కండి, లేదా F5 నొక్కండి; ఒపేరా ను వాడే వారు Tools→Preferences కు వెళ్ళి కాషె ను పూర్తిగా తీసివేయ వలసి ఉంటుంది.

 importScript( 'వాడుకరి:Pavan santhosh.s/ToDoLister.js' ); // Backlink: [[వాడుకరి:Pavan santhosh.s/ToDoLister.js]]
importScript("User:Strike Eagle/prosesize.js");  //For Telugu Wikipedia testing only
importScript('వాడుకరి:Pavan santhosh.s/scripts/SearchHelper.js'); //Linkback: [[వాడుకరి:Pavan santhosh.s/scripts/SearchHelper.js]] Added by Script installer
mediaWiki.loader.load( '//en.wikipedia.org/w/index.php?title=User:Bility/copySectionLink.js&action=raw&ctype=text/javascript' ); //Copies section link
if ( mw.config.get("wgDBname") !== 'ruwiki')
mediaWiki.loader.load( '//ru.wikipedia.org/w/index.php?title=MediaWiki:WEF_AllEditors.js&action=raw&ctype=text/javascript' );//Add Wikidata framework

// Wait for the editing interface to fully load
$(document).ready(function() {
    // Function to replace specific words or phrases with commas
    function replaceWithCommaInEditMode(textToReplace) {
        // Check if we are in edit mode (inside an iframe or textarea)
        if ($('#wpTextbox1').length > 0) { // Check for the textarea used in wikitext editing
            var textarea = document.getElementById('wpTextbox1');
            var originalContent = textarea.value;

            // Replace the text in the textarea with commas
            var modifiedContent = originalContent.replace(textToReplace, ',');

            // Update the textarea with the modified content
            textarea.value = modifiedContent;
        } else if ($('.ve-ce-surface').length > 0) { // Check for VisualEditor
            var veSurface = $('.ve-ce-surface').find('.ve-ce-documentNode-unstylable').get(0);
            
            var originalHtml = veSurface.innerHTML;
            var modifiedHtml = originalHtml.replace(textToReplace, ',');

            // Update the VisualEditor content with the modified HTML
            veSurface.innerHTML = modifiedHtml;

        }
    }

    // Example usage:
    replaceWithCommaInEditMode(' మరియు'); // Replace 'example' with the word you want to replace with commas
});