AddJavascriptFile() public method

public AddJavascriptFile ( string pathToJavascript ) : void
pathToJavascript string
return void
Example #1
0
        private void AddJavaScriptForEditing(HtmlDom dom)
        {
            // BL-117, PH: With the newer xulrunner, javascript code with parenthesis in the URL is not working correctly.

            //dom.AddJavascriptFile("lib/ckeditor/ckeditor.js".ToLocalhost());

            //reviewslog: added this to get the "WebFXTabPane()" working in StyleEditor. Previously tried adding "export" to the function and then importing it
            dom.AddJavascriptFile("lib/tabpane.js".ToLocalhost());

            //reviewslog: four lines are prompted by the qtip "too much recursion" error, which I got on certain pages. The qtip
            //code in question says it is for when jquery-ui is not found. I "solved" this by loading jquery, jquery-ui,
            //and finally qtip into the global space here
            dom.AddJavascriptFile("jquery.min.js".ToLocalhost());
            dom.AddJavascriptFile("modified_libraries/jquery-ui/jquery-ui-1.10.3.custom.min.js".ToLocalhost());
            //			dom.AddJavascriptFile("lib/jquery.qtip.js".ToLocalhost());
            //			dom.AddJavascriptFile("lib/jquery.qtipSecondary.js".ToLocalhost());

            // first tried this as import 'jquery.hotkeys' in bloomEditing, but that didn't work
            //dom.AddJavascriptFile("jquery.hotkeys.js".ToLocalhost());

            dom.AddJavascriptFile("commonBundle.js".ToLocalhost());
            dom.AddJavascriptFile("editablePageBundle.js".ToLocalhost());
            // Add this last because currently its document ready function has to execute AFTER the bootstrap call in bloomEditing.ts,
            // which is compiled into editablePageIFrame.js. The bootstrap function sets CKEDITOR.disableAutoInline = true,
            // which suppresses a document ready function in CKEditor iself from calling inline() on all content editable
            // elements, which we don't want (a) because some content editable elements shouldn't have CKEditor functions, and
            // (b) because it causes crashes when we intentionally do our own inline() calls on the elements where we DO
            // want CKEditor.
            // ReviewSlog: It would be much more robust not to depend on the order in which document ready functions
            // execute, especially if the only control over that is the order of loading files. But I don't know
            // where we can put the CKEDITOR.disableAutoInline = true so that it will reliably execute AFTER CKEDITOR is
            // defined and BEFORE its document ready function.
            dom.AddJavascriptFile("lib/ckeditor/ckeditor.js".ToLocalhost());
        }
Example #2
0
        /// <summary>
        /// Make stuff readonly, which isn't doable via css, surprisingly
        /// </summary>
        /// <param name="dom"></param>
        private void AddPreviewJScript(HtmlDom dom)
        {
            //			XmlElement header = (XmlElement)dom.SelectSingleNodeHonoringDefaultNS("//head");
            //			AddJavascriptFile(dom, header, _storage.GetFileLocator().LocateFileWithThrow("jquery.js"));
            //			AddJavascriptFile(dom, header, _storage.GetFileLocator().LocateFileWithThrow("jquery.myimgscale.js"));
            //
            //			XmlElement script = dom.CreateElement("script");
            //			script.SetAttribute("type", "text/javascript");
            //			script.InnerText = @"jQuery(function() {
            //						$('textarea').focus(function() {$(this).attr('readonly','readonly');});
            //
            //						//make images scale up to their container without distorting their proportions, while being centered within it.
            //						$('img').scaleImage({ scale: 'fit' }); //uses jquery.myimgscale.js
            //			})";
            //			header.AppendChild(script);

            var pathToJavascript = _storage.GetFileLocator().LocateFileWithThrow("bloomPreviewBootstrap.js");
            if(string.IsNullOrEmpty(pathToJavascript))
            {
                throw new ApplicationException("Could not locate " +"bloomPreviewBootstrap.js");
            }
            dom.AddJavascriptFile(pathToJavascript);
        }
Example #3
0
 /// <summary>
 /// Make stuff readonly, which isn't doable via css, surprisingly
 /// </summary>
 /// <param name="dom"></param>
 internal void AddPreviewJavascript(HtmlDom dom)
 {
     dom.AddJavascriptFile("commonBundle.js".ToLocalhost());
     dom.AddJavascriptFile("bookPreviewBundle.js".ToLocalhost());
 }
Example #4
0
 private void AddJavaScriptForEditing(HtmlDom dom)
 {
     dom.AddJavascriptFile(_storage.GetFileLocator().LocateFileWithThrow("bloomBootstrap.js"));
 }