Esempio n. 1
0
        private void applyTranslation(Node node, JsString expression, JsString translation)
        {
            JsString currentValue = node.nodeValue;
            JsString newValue     = currentValue.replace(expression, translation);

            node.nodeValue = newValue;
        }
Esempio n. 2
0
        /**
         * Given a phone number, returns the phone number with all characters, other than numbers, stripped
         * @param {String} phone the phone number to normalize
         * @return {String} the normalized phone number
         * @static
         */
        static JsString normalizePhoneNumber(JsString phone)
        {
            phone = phone.toString();
            JsRegExp regex = new JsRegExp("[^\\d]", "g");

            return(phone.replace(regex, ""));
        }
 public JsString parse( JsString content )
 {
     //We need to get rid of the body element and maybe choose to do away with other things like script
     var bodyRegex = new JsRegExp(@"(</?)body", "gi");
     var sanitizedContent = content.replace(bodyRegex,"$1div");
     return sanitizedContent;
 }
Esempio n. 4
0
        public JsString parse(JsString content)
        {
            //We need to get rid of the body element and maybe choose to do away with other things like script
            var bodyRegex        = new JsRegExp(@"(</?)body", "gi");
            var sanitizedContent = content.replace(bodyRegex, "$1div");

            return(sanitizedContent);
        }
        public virtual string loadClass( JsString qualifiedClassName )
        {
            JsRegExp classNameRegex = new JsRegExp("\\.", "g");
            var potentialURL = qualifiedClassName.replace(classNameRegex, "/");
            potentialURL = dynamicClassBaseUrl + potentialURL;
            potentialURL += ".js";

            xmlHttpRequest.open("GET", potentialURL, false);
            xmlHttpRequest.send("");

            //Todo Need to handle other status than just 404
            if (xmlHttpRequest.status == 404) {
                //Todo This alert shouldnt be here, we should figure out a way to get it to the UI level
                HtmlContext.alert("Required Class " + qualifiedClassName + " cannot be loaded.");
                throw new JsError("Cannot continue, missing required class " + qualifiedClassName);
            }

            return ( xmlHttpRequest.responseText + "\n//@ sourceURL=" + potentialURL );
        }
        public string loadClass(JsString qualifiedClassName)
        {
            JsRegExp classNameRegex = new JsRegExp("\\.", "g");
            var      potentialURL   = qualifiedClassName.replace(classNameRegex, "/");

            potentialURL  = dynamicClassBaseUrl + potentialURL;
            potentialURL += ".js";

            xmlHttpRequest.open("GET", potentialURL, false);
            xmlHttpRequest.send("");

            //Todo Need to handle other status than just 404
            if (xmlHttpRequest.status == 404)
            {
                //Todo This alert shouldnt be here, we should figure out a way to get it to the UI level
                HtmlContext.alert("Required Class " + qualifiedClassName + " cannot be loaded.");
                throw new JsError("Cannot continue, missing required class " + qualifiedClassName);
            }

            return(xmlHttpRequest.responseText + "\n//@ sourceURL=" + potentialURL);
        }
 public static JsString RemoveWhitespace(this JsString s)
 {
     return(s.replace(new JsRegExp("\\s", "g"), ""));
 }