Example #1
0
        private void RenderBookmarkOnClick(string bookmarkLink)
        {
            m_pageWithBookmarkLinks = true;
            WriteStream(" onClick=\"");
            WriteStream(m_deviceInfo.JavascriptPrefixId);
            WriteStream("GoVisibleBookmark('");
            StringBuilder stringBuilder = new StringBuilder();

            HTML4Renderer.QuoteString(stringBuilder, bookmarkLink);
            WriteAttrEncoded(stringBuilder.ToString());
            WriteStream("');return false;");
            WriteStream(HTML4Renderer.m_quote);
            WriteStream(" onkeypress=\"");
            WriteStream(HTML4Renderer.m_checkForEnterKey);
            WriteStream(m_deviceInfo.JavascriptPrefixId);
            WriteStream("GoVisibleBookmark('");
            WriteAttrEncoded(stringBuilder.ToString());
            WriteStream("');return false;}\"");
        }
Example #2
0
 private void RenderFinalScript()
 {
     if (!m_deviceInfo.AllowScript)
     {
         return;
     }
     WriteStream("<script language=\"javascript\" type=\"text/javascript\">");
     WriteStream(HTML4Renderer.m_standardLineBreak);
     WriteStream("//<![CDATA[");
     WriteStream(HTML4Renderer.m_standardLineBreak);
     if (HasFindStringScript)
     {
         WriteStream("window.location.replace('#oHit0');");
     }
     if (HasInteractiveScript)
     {
         if (m_report.ShowHideToggle != null && m_deviceInfo.IsBrowserIE)
         {
             WriteStream("var ");
             WriteStream(m_deviceInfo.JavascriptPrefixId);
             WriteStream("showHideId=\"");
             StringBuilder stringBuilder = new StringBuilder();
             HTML4Renderer.QuoteString(stringBuilder, m_deviceInfo.HtmlPrefixId + m_report.ShowHideToggle);
             WriteStreamEncoded(stringBuilder.ToString());
             WriteStream(HTML4Renderer.m_quote);
             WriteStream(HTML4Renderer.m_standardLineBreak);
             WriteStream("function ");
             WriteStream(m_deviceInfo.JavascriptPrefixId);
             WriteStream("GoToShowHideToggle(){if (document.getElementById(");
             WriteStream(m_deviceInfo.JavascriptPrefixId);
             WriteStream("showHideId) != null)window.location.replace(\"#\"+ ");
             WriteStream(m_deviceInfo.JavascriptPrefixId);
             WriteStream("showHideId);}");
             WriteStream(HTML4Renderer.m_standardLineBreak);
         }
         if (m_pageWithSortClicks)
         {
             WriteStream("var ");
             WriteStream(m_deviceInfo.JavascriptPrefixId);
             WriteStream("sortUrlBase=\"");
             StringBuilder stringBuilder2 = new StringBuilder();
             HTML4Renderer.QuoteString(stringBuilder2, BuildAbsoluteBookmarkOrSortBaseUrl(isSort: true));
             WriteStream(stringBuilder2.ToString());
             WriteStream(HTML4Renderer.m_quote);
             WriteStream(HTML4Renderer.m_standardLineBreak);
             WriteStream("var ");
             WriteStream(m_deviceInfo.JavascriptPrefixId);
             WriteStream("sortDirection=\"&rs:");
             WriteStream("SortDirection");
             WriteStream("=");
             WriteStream(HTML4Renderer.m_quote);
             WriteStream(HTML4Renderer.m_standardLineBreak);
             WriteStream("var ");
             WriteStream(m_deviceInfo.JavascriptPrefixId);
             WriteStream("clearSort=\"&rs:");
             WriteStream("ClearSort");
             WriteStream("=");
             WriteStream(HTML4Renderer.m_quote);
             WriteStream(HTML4Renderer.m_standardLineBreak);
             WriteStream("function ");
             WriteStream(m_deviceInfo.JavascriptPrefixId);
             WriteStream("Sort(id, direction){var clear=true;");
             WriteStream("if (window.event && window.event.shiftKey) clear=false;");
             WriteStream("var sortUrl=");
             WriteStream(m_deviceInfo.JavascriptPrefixId);
             WriteStream("sortUrlBase + id + ");
             WriteStream(m_deviceInfo.JavascriptPrefixId);
             WriteStream("sortDirection + direction + ");
             WriteStream(m_deviceInfo.JavascriptPrefixId);
             WriteStream("clearSort;");
             WriteStream("if (clear) ");
             WriteStream("window.location.replace(sortUrl + \"True\");");
             WriteStream("else ");
             WriteStream("window.location.replace(sortUrl + \"False\");}");
         }
         if (m_report.SortItem != null)
         {
             WriteStream("var ");
             WriteStream(m_deviceInfo.JavascriptPrefixId);
             WriteStream("sortId=\"");
             StringBuilder stringBuilder3 = new StringBuilder();
             HTML4Renderer.QuoteString(stringBuilder3, m_deviceInfo.HtmlPrefixId + m_report.SortItem);
             WriteStreamEncoded(stringBuilder3.ToString());
             WriteStream(HTML4Renderer.m_quote);
             WriteStream(HTML4Renderer.m_standardLineBreak);
             WriteStream("function ");
             WriteStream(m_deviceInfo.JavascriptPrefixId);
             WriteStream("GoToSortItem(){if (document.getElementById(");
             WriteStream(m_deviceInfo.JavascriptPrefixId);
             WriteStream("sortId) != null)window.location.replace(\"#\"+ ");
             WriteStream(m_deviceInfo.JavascriptPrefixId);
             WriteStream("sortId);}");
             WriteStream(HTML4Renderer.m_standardLineBreak);
         }
         if (m_report.HasBookmarks || m_deviceInfo.NavigationId != null)
         {
             WriteStream("function ");
             WriteStream(m_deviceInfo.JavascriptPrefixId);
             WriteStream("GoToBookmark(id){window.location.replace(\"#\"+id);}");
             WriteStream(HTML4Renderer.m_standardLineBreak);
             if (m_pageWithBookmarkLinks)
             {
                 if (m_pageBookmarks == null || m_pageBookmarks.Count < 1)
                 {
                     WriteStream("var ");
                     WriteStream(m_deviceInfo.JavascriptPrefixId);
                     WriteStream("bookmarkIds = [];");
                 }
                 else
                 {
                     WriteStream("var ");
                     WriteStream(m_deviceInfo.JavascriptPrefixId);
                     WriteStream("bookmarkIds = new Array(" + m_pageBookmarks.Count + ");");
                     ICollection keys = m_pageBookmarks.Keys;
                     foreach (string item in keys)
                     {
                         WriteStream(m_deviceInfo.JavascriptPrefixId + "bookmarkIds[\"" + item + "\"] = \"" + m_pageBookmarks[item] + "\";");
                     }
                 }
                 WriteStream(HTML4Renderer.m_standardLineBreak);
                 WriteStream("var ");
                 WriteStream(m_deviceInfo.JavascriptPrefixId);
                 WriteStream("bookmarkUrlBase=\"");
                 StringBuilder stringBuilder4 = new StringBuilder();
                 HTML4Renderer.QuoteString(stringBuilder4, BuildAbsoluteBookmarkOrSortBaseUrl(isSort: false));
                 WriteStream(stringBuilder4.ToString());
                 WriteStream(HTML4Renderer.m_quote);
                 WriteStream(";");
                 WriteStream(HTML4Renderer.m_standardLineBreak);
                 WriteStream("function ");
                 WriteStream(m_deviceInfo.JavascriptPrefixId);
                 WriteStream("GoVisibleBookmark(idLink){if (");
                 WriteStream(m_deviceInfo.JavascriptPrefixId);
                 WriteStream("bookmarkIds == null) return;");
                 WriteStream("var isHref=true;");
                 WriteStream("if (bookmarkIds[idLink] != null) {");
                 WriteStream(m_deviceInfo.JavascriptPrefixId);
                 WriteStream("GoToBookmark(bookmarkIds[idLink]);}");
                 WriteStream("else{window.location.replace(");
                 WriteStream(m_deviceInfo.JavascriptPrefixId);
                 WriteStream("bookmarkUrlBase + '&rc:BookmarkId=' + idLink);}}");
             }
         }
     }
     WriteStream(HTML4Renderer.m_standardLineBreak);
     WriteStream(HTMLRendererResources.GetBytes("Common.js"));
     WriteStream(HTML4Renderer.m_standardLineBreak);
     RenderFitProportionalScript();
     RenderFixedHeaderScripts();
     if (m_needsCanGrowFalseScript)
     {
         WriteStream(HTMLRendererResources.GetBytes("CanGrowFalse.js"));
     }
     if (m_emitImageConsolidationScaling)
     {
         WriteStream(HTMLRendererResources.GetBytes("ImageConsolidation.js"));
     }
     WriteStream("//]]>");
     WriteStream(HTML4Renderer.m_standardLineBreak);
     WriteStream("</script>");
 }