Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8959471
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T15:26:49+00:00 2026-06-15T15:26:49+00:00

<script src=http://cdn.webrupee.com/js type=text/javascript></script> I am localizing the WebRupee script above so that everything (JS,

  • 0
<script src="http://cdn.webrupee.com/js" type="text/javascript"></script>

I am localizing the WebRupee script above so that everything (JS, CSS, font files) is loaded right from my server.

Here goes the beautified code in the JS file:

var _wr_load = window.onload;
window.onload = function () {
    if (typeof (_wr_load) == "function") {
        _wr_load()
    }
    _wr_d = document;
    _wr_l(_wr_d);
    _wr_i(_wr_d.body);
    _wr_re(_wr_d.body)
};
_wr_l = function (f) {
    var d = f.createElement("link");
    d.type = "text/css";
    d.rel = "stylesheet";
    d.href = "http://cdn.webrupee.com/font";
    var e = f.getElementsByTagName("head")[0];
    e.appendChild(d)
};
_wr_i = function (g) {
    var c = g.childNodes;
    var f = c.length;
    for (var h = 0; h < f; h++) {
        if (c[h].nodeType == 3) {
            if (!c[h].nodeValue.match(/^[\s]*$/)) {
                r = c[h].nodeValue;
                r = r.replace(/\s(Rs|Rs\.)\s/gi, " Rs. ");
                r = r.replace(/^(Rs|Rs\.)\s/gi, " Rs. ");
                r = _we_reg(r, /\sRs\.[0-9]+\s/gi, /(Rs\.)/gi);
                r = _we_reg(r, /^Rs\.[0-9]+$/gi, /Rs\./gi);
                r = _we_reg(r, /^Rs\.[0-9,]+[0-9]$/gi, /Rs\./gi);
                r = _we_reg(r, /^Rs\.[0-9,]+[0-9]\s/gi, /Rs\./gi);
                r = _we_reg(r, /\sRs\.[0-9,]+[0-9]\s/gi, /Rs\./gi);
                r = _we_reg(r, /\sRs\.[0-9,]+[0-9]\./gi, /Rs\./gi);
                r = _we_reg(r, /^Rs\.[0-9,]+[0-9]\./gi, /Rs\./gi);
                r = _we_reg(r, /\sRs\.[0-9,]+[0-9]\//gi, /Rs\./gi);
                r = _we_reg(r, /^Rs\.[0-9,]+[0-9]\//gi, /Rs\./gi);
                r = _we_reg(r, /\sRs\.[0-9,]+[0-9]/gi, /Rs\./gi);
                c[h].nodeValue = r
            }
        } else {
            if (c[h].nodeName.toLowerCase() != "script") {
                _wr_i(c[h])
            }
        }
    }
};
_we_reg = function (f, a, b) {
    var c = new RegExp(a);
    var e = c.exec(f);
    while (e != null) {
        var d = String(e);
        d = d.replace(b, " Rs. ");
        f = f.replace(e, d);
        e = c.exec(f)
    }
    return f
};
_wr_re = function (k) {
    var c = 0;
    if (k.nodeType == 3) {
        var n = k.data.indexOf(" Rs. ");
        if (n >= 0) {
            var m = document.createElement("span");
            m.className = "WebRupee";
            var e = k.splitText(n);
            var o = e.splitText(5);
            var p = e.cloneNode(true);
            m.appendChild(p);
            e.parentNode.replaceChild(m, e);
            c = 1
        }
    } else {
        if (k.nodeType == 1 && k.childNodes && !/(script|style)/i.test(k.tagName)) {
            for (var l = 0; l < k.childNodes.length; ++l) {
                l += _wr_re(k.childNodes[l])
            }
        }
    }
    return c
};

The JavaScript code does a few things, and one thing of prime interest to me is that, it dynamically adds this in HTML:

<link type="text/css" rel="stylesheet" href="http://cdn.webrupee.com/font">

What I want to do is, add the link element myself, and remove the then unnecessary, relevant JavaScript code from the file.

As far as I see it, this is the one:

_wr_l = function (f) {
    var d = f.createElement("link");
    d.type = "text/css";
    d.rel = "stylesheet";
    d.href = "http://cdn.webrupee.com/font";
    var e = f.getElementsByTagName("head")[0];
    e.appendChild(d)
};

But simply removing the snippet from the JS file, breaks its functionality (i.e. replacing ‘Rs.’ with the new India Rupee symbol). So, what am I doing wrong?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T15:26:51+00:00Added an answer on June 15, 2026 at 3:26 pm

    You have removed the line at the top which calls the function, right?

    _wr_l(_wr_d);
    

    (if you remove the function definition _wr_l() then any attempts to call that function will fail).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've written this HAML: %script{:src => http://www.google.com/jsapi?key=mykey :type => text/javascript} Note the missing comma
var script = document.createElement( 'script' ); script.type = 'text/javascript'; script.src = 'http://www.mydomain.com/bleh.php'; script.id =
Possible Duplicate: What is my script src URL? I have situation: <script type=text/javascript src=http://server/some.js>
I made this bookmarklet: javascript:(function(){var s=document.createElement('script');s.setAttribute('src','http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js');document.getElementsByTagName('body')[0].appendChild(s);$('#hldIntMain').hide();$('#fadeBackground').hide();return false;})() Formatted code: // Add in jQuery var
Here is my preload script: <script type=text/javascript> Image_1 = new Image(1,1); Image_1.src = images/sprites.png;
Here is fragments of my HAML view: %script{:type => text/javascript, :src => assets/application.js} :javascript
this is my ajax call <script src = js/jquery.js type = text/javascript></script> <script type=text/javascript>
I have fetched json through <script> function getjs() { var script =document.createElement(script); script.setAttribute(type,text/javascript); script.setAttribute(src,http://localhost:8080/vigs/f4json?user=3&callback=gr);
I'm looking at the http://code.google.com/chrome/extensions/contentSecurityPolicy.html documentation and seeing: { ..., content_security_policy: script-src 'self' https://example.com;
I'm using this method when file is loaded: $(<script/>, { class: test, src: 'http://www.externalSite.com/js/xxx.js'

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.