| | |
| Stránka: 1 z 1
| [ Príspevkov: 3 ] | |
Autor | Správa |
---|
Registrovaný: 02.10.06 Prihlásený: 09.09.10 Príspevky: 29 Témy: 12 | Napísal Frees: 28.03.2009 11:41 | |
|
Nazdar, mal by som jednu prosbu. Na internete som nasiel tento userscript pre Greasemonkey, ktory sluzi na zmenu textu, napr. miesto lol napise lot of laughts a podobne. Funguje perfektne, ja by som vsak potreboval, aby na stranke zmenil len prve slovo. napr. v clanke je 4x spomenute slovo depresia a ja by som chcel aby to prve slovo premenoval na depka a ostatne tri nechal napokoj. Dalo by sa to nejako urobit? Toto je zdrojak skriptu
Kód: // ==UserScript== // @name Replace Text On Webpages // @namespace http://userscripts.org/users/23652 // @description Replaces text on websites. Now supports wildcards in search queries // @include http://* // @include https://* // @include file://* // @exclude http://userscripts.org/scripts/review/* // @copyright JoeSimmons // ==/UserScript==
var words = { /////////////////////////////////////////////////////// // Syntax: 'Search word' : 'Replace word', 'im*o' : 'in my opinion', // Will get imo and any characters between m and o /////////////////////////////////////////////////////// '4.5' : '12','6' : '71'};
// This is where the real code is // Don't edit below this
// Grab the text nodes var this_text, text = document.evaluate("//text()[normalize-space(.)!='']",document,null,6,null);
for(var i=text.snapshotLength-1; i>=0; i--) {
// Create a shortcut for the text node this_text = text.snapshotItem(i);
// Iterate the words array for(word in words) { // Turn the search term into a regular expression // allowing wildcards (*) to be used for any character var search_regexp = new RegExp(word.replace(/\*/g,'.*'), 'gi'); // Exclude the blank option at the bottom of the array words // so every entry can have a comma after it for easy entry of blacklisted words // And if the text node contains the blacklisted word // And if the text isn't inside a link if(word!='' && search_regexp.test (this_text.textContent) && this_text.parentNode.tagName!='A') { // Replace the blacklisted word with the appropriate word this_text.textContent = this_text.textContent.replace(search_regexp, words[word]); } } }
_________________ PC::Základná doska : Asus P4U800-X, Čipset : Ali Uli 1633 M, Procesor : Intel Celeron D @ 2660 MHz, Chladič : Arcting Colling Super Ultra TC, Fyzická pamäť : 1536 MB (1 x 1024 DDR400, 1 x 512 DDR400), Grafická karta : Sparkle Geforce 7600 GS 512 MB, Pevný disk :Hitachi 80 GB, Jednotka DVD-RW : LG GSA H55L, Operačný systém : Microsoft Windows Seven Ultimate RC, DirectX : Verzia 11
NB::Samsung R510, Intel Celeron Dual Core @ 1830 MHz, 2 GB DDR2 ram, 160 GB Samsung HDD, Intel GMA 4500 MHD, 15,4 " displej |
|
Registrovaný: 11.08.07 Príspevky: 4088 Témy: 34 Bydlisko: Brno | Napísal Ďuri: 28.03.2009 12:36 | |
|
Skus Kód: new RegExp(word.replace(/\*/g,'.*'), 'gi'); nahradit s Kód: new RegExp(word.replace(/\*/g,'.*'), 'i');
|
|
Registrovaný: 02.10.06 Prihlásený: 09.09.10 Príspevky: 29 Témy: 12 | Napísal autor témy Frees: 28.03.2009 12:43 | |
|
nepomohlo
_________________ PC::Základná doska : Asus P4U800-X, Čipset : Ali Uli 1633 M, Procesor : Intel Celeron D @ 2660 MHz, Chladič : Arcting Colling Super Ultra TC, Fyzická pamäť : 1536 MB (1 x 1024 DDR400, 1 x 512 DDR400), Grafická karta : Sparkle Geforce 7600 GS 512 MB, Pevný disk :Hitachi 80 GB, Jednotka DVD-RW : LG GSA H55L, Operačný systém : Microsoft Windows Seven Ultimate RC, DirectX : Verzia 11
NB::Samsung R510, Intel Celeron Dual Core @ 1830 MHz, 2 GB DDR2 ram, 160 GB Samsung HDD, Intel GMA 4500 MHD, 15,4 " displej |
|
| Stránka: 1 z 1
| [ Príspevkov: 3 ] | |
Podobné témy | Témy | Odpovede | Zobrazenia | Posledný príspevok |
---|
| Replace text v JavaScript, VBScript, Ajax | 5 | 477 | 28.05.2012 13:49 xxx9955 | | Text Font pre web - stream v Webdesign | 3 | 445 | 31.05.2012 23:39 shaggy | | Regex replace v Ostatné | 5 | 375 | 02.07.2021 14:53 MTK | | Replace Textu v PHP, ASP | 12 | 594 | 05.08.2009 9:52 p360t | | PHP replace help v PHP, ASP | 4 | 662 | 13.04.2008 19:31 Ded'leg | | string.replace na viac riadkoch nefunguje v JavaScript, VBScript, Ajax | 11 | 714 | 22.03.2011 14:50 camo | | Invalid system disk replace the disk and press any key v Operačné systémy Microsoft | 5 | 825 | 26.04.2008 6:20 mig07 | | "Search and Replace" Shell skript v Ostatné | 1 | 514 | 13.06.2011 19:03 Ďuri | | Hľadáme programátora web stránok a web aplikácií v Ponuka práce | 0 | 731 | 27.02.2013 11:51 artexe | | Web hosting control panel pre free web v Webhosting a servery | 1 | 1055 | 06.04.2019 8:05 rukitinc | | Hľadáme (1.) web dizajnéra a (2.) web kódera - na dlhodobú spoluprácu / práca z domu v Ponuka práce | 0 | 772 | 15.01.2015 9:12 crystalgroup | | web kamera & web v Video programy | 4 | 848 | 29.12.2007 13:22 jablko05 | | Text v HTML, XHTML, XML, CSS | 3 | 897 | 15.10.2007 21:10 enorm | | text v Audio programy | 5 | 522 | 24.07.2012 13:24 dangerous_123 | | Text v HTML, XHTML, XML, CSS | 5 | 690 | 26.10.2009 17:23 hajtrak | | text v Grafické programy | 2 | 850 | 12.03.2008 19:49 Enermax |
| Nemôžete zakladať nové témy v tomto fóre Nemôžete odpovedať na témy v tomto fóre Nemôžete upravovať svoje príspevky v tomto fóre Nemôžete mazať svoje príspevky v tomto fóre
|
|