Search Results

Search found 5 results on 1 pages for 'shizhidi'.

Page 1/1 | 1 

  • Write an add-on or greasemonkey script to "Ajaxify" webpages in Firefox?

    - by Shizhidi
    Hello. I stumbled upon this add-on which "Ajaxifies" parts of its target website. https://addons.mozilla.org/en-US/firefox/addon/51789 I have a similar need like this. I want only part of the webpage's DOM to update upon receiving click on a link, since the website has a rather unified page layout. I have no experiences in writing FF add-ons but I did some basic Ajax and DOM before. So I am looking for programming tips on how to implement "Ajaxification" in a GreaseMonkey script, preferably. If it's not possible, making an add-on is also a sound choice which I'm willing to learn. Thanks in advance!

    Read the article

  • jQuery: list appended not displaying bullets

    - by Shizhidi
    I have the following html: <!DOCTYPE html> <html> <head> <script src="http://code.jquery.com/jquery-latest.js"></script> </head> <body> <span>not so important</span> <span title="some specific text"><img src="/img/some.gif" /></span> <span title="more specific text">important 1</span> <span title="more specific text">important 2</span> <span title="more specific text">important 3</span> <span title="more specific text"><img src="/img/some.gif" /></span> <ul> <li>example 1</li> <li>example 2</li> <li>example 3</li> <ul> <script> var ul = $('body').append($('<ul>')); $("span[title*='specific text']") .contents() .filter(function(){ return $(this).nodeType != 1; }) .each(function(){ ul.append($('<li>' + $(this).text() + '</li>')); }) </script> </body> </html> I want to retrieve the text within a 'span' whose title attribute contains "specific text", in this case "important 1", "important 2" and "important 3". Then I want to list them below just like the example. However the bullets do not appear, why is that? Any hints would be appreciated!

    Read the article

  • Write a GreaseMonkey script that reacts to domain strings (for I18N, e.g. cn,en,fr,etc.)

    - by Shizhidi
    Hello. Suppose there is a website that supports multiple languages: cn.mydomain.com or mydomain.com/cn or mydomain.cn en.mydomain.com or mydomain.com/en or mydomain.com fr.mydomain.com or mydomain.com/fr or mydomain.fr I want to write a GreaseMonkey script that has variables assigned different strings/values according to the address the user is loading the page from. How do you do that? Thanks EDIT: I realize I can just use JavaScript to get the address. Does GreaseMonkey itself support this kind of function?

    Read the article

  • Remove leading whitespaces using variable length lookbehind in RegExp

    - by Shizhidi
    Hello, I'm wondering if variable length lookbehind assertions are supported in JavaScript's RegExp engine? For example, I'm trying to match the string "variable length" in the string "[a lot of whitespaces and/or tabs]variable length lookbehind", and I have something like this but it does not go well in various RegExp testers: ^(?<=[ \t]+).+(?= lookbehind) If it's an illegal pattern, what would be a good workaround to it? Thanks!

    Read the article

  • Chrome: Dynamically created <style> tag does not have content?

    - by Shizhidi
    Hello. I encountered a weird problem when trying to write a cross-browser script. Basically my header looks like this <html> <head> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script> </head> Then in the body tag: <p id="hey">Hey</p> <input type="button" value="attachStyle" name="attachStyle" onclick="attachStyle();"></input> <script> function attachStyle() { var strVar=""; strVar += "<style type='text\/css'>#hey {border:5px solid red;}<\/script>"; $("head").append(strVar); } </script> The button works in Firefox, but not in Chrome. When I looked at the html DOM elements in the developer tool, the style tag was inserted but without content, like this: <html> <head> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script> <style type='text/css'></script> </head> I'm curious as to what causes this? And how to create CSS style in a way that is cross-browser? Thanks!

    Read the article

1