Skip to content
This repository
Fetching contributors…

Octocat-spinner-32-eaf2f5

Cannot retrieve contributors at this time

file 124 lines (117 sloc) 32.314 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124
<!DOCTYPE html> <html> <head> <title>mediaOverlay.js</title> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> <link rel="stylesheet" media="all" href="docco.css" /> </head> <body> <div id="container"> <div id="background"></div> <div id="jump_to"> Jump To &hellip; <div id="jump_wrapper"> <div id="jump_page"> <a class="source" href="plugins.html"> plugins.js </a> <a class="source" href="web_plugins.html"> web_plugins.js </a> <a class="source" href="alternate_style_tag_selector.html"> alternate_style_tag_selector.js </a> <a class="source" href="audioClipPlayer.html"> audioClipPlayer.js </a> <a class="source" href="epub.html"> epub.js </a> <a class="source" href="epub_controller.html"> epub_controller.js </a> <a class="source" href="ibooks_options_parser.html"> ibooks_options_parser.js </a> <a class="source" href="manifest_item.html"> manifest_item.js </a> <a class="source" href="mediaOverlay.html"> mediaOverlay.js </a> <a class="source" href="options_presenter.html"> options_presenter.js </a> <a class="source" href="packageDocument.html"> packageDocument.js </a> <a class="source" href="package_document_parser.html"> package_document_parser.js </a> <a class="source" href="page_number_display_logic.html"> page_number_display_logic.js </a> <a class="source" href="pagination_strategy_selector.html"> pagination_strategy_selector.js </a> <a class="source" href="path_resolver.html"> path_resolver.js </a> <a class="source" href="readium_options.html"> readium_options.js </a> <a class="source" href="readium_pagination.html"> readium_pagination.js </a> <a class="source" href="smilModel.html"> smilModel.js </a> <a class="source" href="toc.html"> toc.js </a> <a class="source" href="trigger.html"> trigger.js </a> <a class="source" href="validated_package_meta_data.html"> validated_package_meta_data.js </a> <a class="source" href="crx_library_namespace.html"> crx_library_namespace.js </a> <a class="source" href="crx_viewer_namespace.html"> crx_viewer_namespace.js </a> <a class="source" href="ws_lib_namespace.html"> ws_lib_namespace.js </a> <a class="source" href="crx_library_router.html"> crx_library_router.js </a> <a class="source" href="crx_viewer_router.html"> crx_viewer_router.js </a> <a class="source" href="ws_router.html"> ws_router.js </a> <a class="source" href="bb_file_system_sync.html"> bb_file_system_sync.js </a> <a class="source" href="cookie_utils.html"> cookie_utils.js </a> <a class="source" href="handlebars_helpers.html"> handlebars_helpers.js </a> <a class="source" href="local_storage_sync.html"> local_storage_sync.js </a> <a class="source" href="md5.html"> md5.js </a> <a class="source" href="user_agent_utils.html"> user_agent_utils.js </a> <a class="source" href="nav_widget_view.html"> nav_widget_view.js </a> <a class="source" href="options_view.html"> options_view.js </a> <a class="source" href="toc_view.html"> toc_view.js </a> <a class="source" href="toolbar_view.html"> toolbar_view.js </a> <a class="source" href="httpFileApi.html"> httpFileApi.js </a> <a class="source" href="library.html"> library.js </a> <a class="source" href="viewer.html"> viewer.js </a> </div> </div> </div> <table cellpadding="0" cellspacing="0"> <thead> <tr> <th class="docs"> <h1> mediaOverlay.js </h1> </th> <th class="code"> </th> </tr> </thead> <tbody> <tr id="section-1"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-1">&#182;</a> </div> <p>loads and plays a single SMIL document</p> </td> <td class="code"> <div class="highlight"><pre><span class="nx">Readium</span><span class="p">.</span><span class="nx">Models</span><span class="p">.</span><span class="nx">MediaOverlay</span> <span class="o">=</span> <span class="nx">Backbone</span><span class="p">.</span><span class="nx">Model</span><span class="p">.</span><span class="nx">extend</span><span class="p">({</span>
    <span class="nx">audioplayer</span><span class="o">:</span> <span class="kc">null</span><span class="p">,</span>
    <span class="nx">smilModel</span><span class="o">:</span> <span class="kc">null</span><span class="p">,</span>
    </pre></div> </td> </tr> <tr id="section-2"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-2">&#182;</a> </div> <p>observable properties</p> </td> <td class="code"> <div class="highlight"><pre> <span class="nx">defaults</span><span class="o">:</span> <span class="p">{</span>
        <span class="nx">is_ready</span><span class="o">:</span> <span class="kc">false</span><span class="p">,</span>
        <span class="nx">is_document_done</span><span class="o">:</span> <span class="kc">false</span><span class="p">,</span>
        <span class="nx">is_playing</span><span class="o">:</span> <span class="kc">false</span><span class="p">,</span>
        <span class="nx">should_highlight</span><span class="o">:</span> <span class="kc">true</span><span class="p">,</span>
        <span class="nx">current_text_document_url</span><span class="o">:</span> <span class="kc">null</span><span class="p">,</span>
        <span class="nx">current_text_element_id</span><span class="o">:</span> <span class="kc">null</span><span class="p">,</span>
        <span class="nx">has_started_playback</span><span class="o">:</span> <span class="kc">false</span>
    <span class="p">},</span>
    </pre></div> </td> </tr> <tr id="section-3"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-3">&#182;</a> </div> <p>initialize with a "smil_url" option</p> </td> <td class="code"> <div class="highlight"><pre> <span class="nx">initialize</span><span class="o">:</span> <span class="kd">function</span><span class="p">()</span> <span class="p">{</span>
        <span class="kd">var</span> <span class="nx">self</span> <span class="o">=</span> <span class="k">this</span><span class="p">;</span>
        <span class="k">this</span><span class="p">.</span><span class="nx">audioplayer</span> <span class="o">=</span> <span class="k">new</span> <span class="nx">Readium</span><span class="p">.</span><span class="nx">Models</span><span class="p">.</span><span class="nx">AudioClipPlayer</span><span class="p">();</span>
        <span class="k">this</span><span class="p">.</span><span class="nx">audioplayer</span><span class="p">.</span><span class="nx">setConsoleTrace</span><span class="p">(</span><span class="kc">true</span><span class="p">);</span>

        <span class="k">this</span><span class="p">.</span><span class="nx">url</span> <span class="o">=</span> <span class="k">this</span><span class="p">.</span><span class="nx">get</span><span class="p">(</span><span class="s2">&quot;smil_url&quot;</span><span class="p">);</span>
        </pre></div> </td> </tr> <tr id="section-4"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-4">&#182;</a> </div> <p>always know whether we're playing or paused</p> </td> <td class="code"> <div class="highlight"><pre> <span class="k">this</span><span class="p">.</span><span class="nx">audioplayer</span><span class="p">.</span><span class="nx">setNotifyOnPause</span><span class="p">(</span><span class="kd">function</span><span class="p">()</span> <span class="p">{</span>
            <span class="nx">self</span><span class="p">.</span><span class="nx">set</span><span class="p">({</span><span class="nx">is_playing</span><span class="o">:</span> <span class="nx">self</span><span class="p">.</span><span class="nx">audioplayer</span><span class="p">.</span><span class="nx">isPlaying</span><span class="p">()});</span>
        <span class="p">});</span>
        <span class="k">this</span><span class="p">.</span><span class="nx">audioplayer</span><span class="p">.</span><span class="nx">setNotifyOnPlay</span><span class="p">(</span><span class="kd">function</span><span class="p">(){</span>
           <span class="nx">self</span><span class="p">.</span><span class="nx">set</span><span class="p">({</span><span class="nx">is_playing</span><span class="o">:</span> <span class="nx">self</span><span class="p">.</span><span class="nx">audioplayer</span><span class="p">.</span><span class="nx">isPlaying</span><span class="p">()});</span>
        <span class="p">});</span>
        
    <span class="p">},</span>
    
    <span class="nx">fetch</span><span class="o">:</span> <span class="kd">function</span><span class="p">(</span><span class="nx">options</span><span class="p">)</span> <span class="p">{</span>
        <span class="k">this</span><span class="p">.</span><span class="nx">set</span><span class="p">({</span><span class="nx">is_ready</span><span class="o">:</span> <span class="kc">false</span><span class="p">});</span>
        <span class="nx">options</span> <span class="o">||</span> <span class="p">(</span><span class="nx">options</span> <span class="o">=</span> <span class="p">{});</span>
        <span class="nx">options</span><span class="p">.</span><span class="nx">dataType</span><span class="o">=</span><span class="s2">&quot;xml&quot;</span><span class="p">;</span>
        <span class="nx">Backbone</span><span class="p">.</span><span class="nx">Model</span><span class="p">.</span><span class="nx">prototype</span><span class="p">.</span><span class="nx">fetch</span><span class="p">.</span><span class="nx">call</span><span class="p">(</span><span class="k">this</span><span class="p">,</span> <span class="nx">options</span><span class="p">);</span>
    <span class="p">},</span></pre></div> </td> </tr> <tr id="section-5"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-5">&#182;</a> </div> <p>backbone fetch() callback</p> </td> <td class="code"> <div class="highlight"><pre> <span class="nx">parse</span><span class="o">:</span> <span class="kd">function</span><span class="p">(</span><span class="nx">xml</span><span class="p">)</span> <span class="p">{</span>
        <span class="kd">var</span> <span class="nx">self</span> <span class="o">=</span> <span class="k">this</span><span class="p">;</span>
        <span class="k">this</span><span class="p">.</span><span class="nx">smilModel</span> <span class="o">=</span> <span class="k">new</span> <span class="nx">Readium</span><span class="p">.</span><span class="nx">Models</span><span class="p">.</span><span class="nx">SmilModel</span><span class="p">();</span>
        <span class="k">this</span><span class="p">.</span><span class="nx">smilModel</span><span class="p">.</span><span class="nx">setUrl</span><span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">get</span><span class="p">(</span><span class="s2">&quot;smil_url&quot;</span><span class="p">));</span>
        <span class="k">this</span><span class="p">.</span><span class="nx">smilModel</span><span class="p">.</span><span class="nx">setNotifySmilDone</span><span class="p">(</span><span class="kd">function</span><span class="p">()</span> <span class="p">{</span>
            <span class="nx">self</span><span class="p">.</span><span class="nx">set</span><span class="p">({</span><span class="nx">is_document_done</span><span class="o">:</span> <span class="kc">true</span><span class="p">});</span>
        <span class="p">});</span>
        </pre></div> </td> </tr> <tr id="section-6"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-6">&#182;</a> </div> <p>very important piece of code: attach render functions to the model
at runtime, 'this' is the node in question</p> </td> <td class="code"> <div class="highlight"><pre> <span class="k">this</span><span class="p">.</span><span class="nx">smilModel</span><span class="p">.</span><span class="nx">addRenderers</span><span class="p">({</span>
            <span class="s2">&quot;audio&quot;</span><span class="o">:</span> <span class="kd">function</span><span class="p">()</span> <span class="p">{</span></pre></div> </td> </tr> <tr id="section-7"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-7">&#182;</a> </div> <p>have the audio player inform the node directly when it's done playing</p> </td> <td class="code"> <div class="highlight"><pre> <span class="kd">var</span> <span class="nx">thisNode</span> <span class="o">=</span> <span class="k">this</span><span class="p">;</span>
                <span class="nx">self</span><span class="p">.</span><span class="nx">audioplayer</span><span class="p">.</span><span class="nx">setNotifyClipDone</span><span class="p">(</span><span class="kd">function</span><span class="p">()</span> <span class="p">{</span>
                    <span class="nx">thisNode</span><span class="p">.</span><span class="nx">notifyChildDone</span><span class="p">();</span>
                <span class="p">});</span>
                <span class="kd">var</span> <span class="nx">isJumpTarget</span> <span class="o">=</span> <span class="kc">false</span><span class="p">;</span>
                <span class="k">if</span> <span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">hasOwnProperty</span><span class="p">(</span><span class="s2">&quot;isJumpTarget&quot;</span><span class="p">))</span> <span class="p">{</span>
                    <span class="nx">isJumpTarget</span> <span class="o">=</span> <span class="k">this</span><span class="p">.</span><span class="nx">isJumpTarget</span><span class="p">;</span></pre></div> </td> </tr> <tr id="section-8"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-8">&#182;</a> </div> <p>reset the node's property</p> </td> <td class="code"> <div class="highlight"><pre> <span class="k">this</span><span class="p">.</span><span class="nx">isJumpTarget</span> <span class="o">=</span> <span class="kc">false</span><span class="p">;</span>
                <span class="p">}</span></pre></div> </td> </tr> <tr id="section-9"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-9">&#182;</a> </div> <p>play the node</p> </td> <td class="code"> <div class="highlight"><pre> <span class="nx">self</span><span class="p">.</span><span class="nx">audioplayer</span><span class="p">.</span><span class="nx">play</span><span class="p">(</span><span class="nx">$</span><span class="p">(</span><span class="k">this</span><span class="p">).</span><span class="nx">attr</span><span class="p">(</span><span class="s2">&quot;src&quot;</span><span class="p">),</span> <span class="nb">parseFloat</span><span class="p">(</span><span class="nx">$</span><span class="p">(</span><span class="k">this</span><span class="p">).</span><span class="nx">attr</span><span class="p">(</span><span class="s2">&quot;clipBegin&quot;</span><span class="p">)),</span> <span class="nb">parseFloat</span><span class="p">(</span><span class="nx">$</span><span class="p">(</span><span class="k">this</span><span class="p">).</span><span class="nx">attr</span><span class="p">(</span><span class="s2">&quot;clipEnd&quot;</span><span class="p">)),</span> <span class="nx">isJumpTarget</span><span class="p">);</span>
            <span class="p">},</span>
            <span class="s2">&quot;text&quot;</span><span class="o">:</span> <span class="kd">function</span><span class="p">(){</span>
                <span class="kd">var</span> <span class="nx">src</span> <span class="o">=</span> <span class="nx">$</span><span class="p">(</span><span class="k">this</span><span class="p">).</span><span class="nx">attr</span><span class="p">(</span><span class="s2">&quot;src&quot;</span><span class="p">);</span></pre></div> </td> </tr> <tr id="section-10"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-10">&#182;</a> </div> <p>broadcast the text properties so that any listeners can do the right thing wrt loading/highlighting text</p> </td> <td class="code"> <div class="highlight"><pre> <span class="nx">self</span><span class="p">.</span><span class="nx">set</span><span class="p">({</span>
                    <span class="nx">current_text_document_url</span><span class="o">:</span> <span class="nx">self</span><span class="p">.</span><span class="nx">stripFragment</span><span class="p">(</span><span class="nx">src</span><span class="p">),</span>
                    <span class="nx">current_text_element_id</span><span class="o">:</span> <span class="nx">self</span><span class="p">.</span><span class="nx">getFragment</span><span class="p">(</span><span class="nx">src</span><span class="p">)</span>
                <span class="p">});</span>
            <span class="p">}</span>
        <span class="p">});</span>
        </pre></div> </td> </tr> <tr id="section-11"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-11">&#182;</a> </div> <p>start the playback tree at <body></p> </td> <td class="code"> <div class="highlight"><pre> <span class="kd">var</span> <span class="nx">smiltree</span> <span class="o">=</span> <span class="nx">$</span><span class="p">(</span><span class="nx">xml</span><span class="p">).</span><span class="nx">find</span><span class="p">(</span><span class="s2">&quot;body&quot;</span><span class="p">)[</span><span class="mi">0</span><span class="p">];</span>
        <span class="k">this</span><span class="p">.</span><span class="nx">smilModel</span><span class="p">.</span><span class="nx">build</span><span class="p">(</span><span class="nx">smiltree</span><span class="p">);</span>
        <span class="k">this</span><span class="p">.</span><span class="nx">set</span><span class="p">({</span><span class="nx">is_ready</span><span class="o">:</span> <span class="kc">true</span><span class="p">});</span>
    <span class="p">},</span></pre></div> </td> </tr> <tr id="section-12"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-12">&#182;</a> </div> <p>start playback
node is a SMIL node that indicates the starting point
if node is null, playback starts at the beginning</p> </td> <td class="code"> <div class="highlight"><pre> <span class="nx">startPlayback</span><span class="o">:</span> <span class="kd">function</span><span class="p">(</span><span class="nx">node</span><span class="p">)</span> <span class="p">{</span>
        <span class="k">if</span> <span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">get</span><span class="p">(</span><span class="s2">&quot;is_ready&quot;</span><span class="p">)</span> <span class="o">==</span> <span class="kc">false</span><span class="p">)</span> <span class="p">{</span>
            <span class="k">return</span><span class="p">;</span>
        <span class="p">}</span>
        <span class="k">this</span><span class="p">.</span><span class="nx">set</span><span class="p">({</span><span class="nx">is_document_done</span><span class="o">:</span> <span class="kc">false</span><span class="p">});</span>
        <span class="k">this</span><span class="p">.</span><span class="nx">set</span><span class="p">({</span><span class="nx">has_started_playback</span><span class="o">:</span> <span class="kc">true</span><span class="p">});</span>
        <span class="k">this</span><span class="p">.</span><span class="nx">smilModel</span><span class="p">.</span><span class="nx">render</span><span class="p">(</span><span class="nx">node</span><span class="p">);</span>
    <span class="p">},</span>
    <span class="nx">pause</span><span class="o">:</span> <span class="kd">function</span><span class="p">()</span> <span class="p">{</span>
        <span class="k">if</span> <span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">get</span><span class="p">(</span><span class="s2">&quot;is_ready&quot;</span><span class="p">)</span> <span class="o">==</span> <span class="kc">false</span><span class="p">)</span> <span class="p">{</span>
            <span class="k">return</span><span class="p">;</span>
        <span class="p">}</span>
        <span class="k">if</span> <span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">get</span><span class="p">(</span><span class="s2">&quot;has_started_playback&quot;</span><span class="p">)</span> <span class="o">==</span> <span class="kc">false</span><span class="p">)</span> <span class="p">{</span>
            <span class="k">return</span><span class="p">;</span>
        <span class="p">}</span>
        <span class="k">this</span><span class="p">.</span><span class="nx">audioplayer</span><span class="p">.</span><span class="nx">pause</span><span class="p">();</span>
    <span class="p">},</span>
    <span class="nx">resume</span><span class="o">:</span> <span class="kd">function</span><span class="p">()</span> <span class="p">{</span>
        <span class="k">if</span> <span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">get</span><span class="p">(</span><span class="s2">&quot;is_ready&quot;</span><span class="p">)</span> <span class="o">==</span> <span class="kc">false</span><span class="p">)</span> <span class="p">{</span>
            <span class="k">return</span><span class="p">;</span>
        <span class="p">}</span>
        <span class="k">if</span> <span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">get</span><span class="p">(</span><span class="s2">&quot;has_started_playback&quot;</span><span class="p">)</span> <span class="o">==</span> <span class="kc">false</span><span class="p">)</span> <span class="p">{</span>
            <span class="k">return</span><span class="p">;</span>
        <span class="p">}</span>
        <span class="k">this</span><span class="p">.</span><span class="nx">audioplayer</span><span class="p">.</span><span class="nx">resume</span><span class="p">();</span>
    <span class="p">},</span>
    <span class="nx">findNodeByTextSrc</span><span class="o">:</span> <span class="kd">function</span><span class="p">(</span><span class="nx">src</span><span class="p">)</span> <span class="p">{</span>
        <span class="k">if</span> <span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">get</span><span class="p">(</span><span class="s2">&quot;is_ready&quot;</span><span class="p">)</span> <span class="o">==</span> <span class="kc">false</span><span class="p">)</span> <span class="p">{</span>
            <span class="k">return</span><span class="p">;</span>
        <span class="p">}</span>
        
        <span class="kd">var</span> <span class="nx">elm</span> <span class="o">=</span> <span class="k">this</span><span class="p">.</span><span class="nx">smilModel</span><span class="p">.</span><span class="nx">findNodeByAttrValue</span><span class="p">(</span><span class="s2">&quot;text&quot;</span><span class="p">,</span> <span class="s2">&quot;src&quot;</span><span class="p">,</span> <span class="nx">src</span><span class="p">);</span>
        <span class="k">if</span> <span class="p">(</span><span class="nx">elm</span> <span class="o">==</span> <span class="kc">null</span><span class="p">){</span>
            <span class="nx">elm</span> <span class="o">=</span> <span class="k">this</span><span class="p">.</span><span class="nx">smilModel</span><span class="p">.</span><span class="nx">findNodeByAttrValue</span><span class="p">(</span><span class="s2">&quot;seq&quot;</span><span class="p">,</span> <span class="s2">&quot;epub:textref&quot;</span><span class="p">,</span> <span class="nx">src</span><span class="p">);</span>
        <span class="p">}</span>
        <span class="k">return</span> <span class="nx">elm</span><span class="p">;</span>
    <span class="p">},</span>
    <span class="nx">setVolume</span><span class="o">:</span> <span class="kd">function</span><span class="p">(</span><span class="nx">volume</span><span class="p">)</span> <span class="p">{</span>
        <span class="k">if</span> <span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">get</span><span class="p">(</span><span class="s2">&quot;is_ready&quot;</span><span class="p">)</span> <span class="o">==</span> <span class="kc">false</span><span class="p">)</span> <span class="p">{</span>
            <span class="k">return</span><span class="p">;</span>
        <span class="p">}</span>
        
        <span class="k">this</span><span class="p">.</span><span class="nx">audioplayer</span><span class="p">.</span><span class="nx">setVolume</span><span class="p">(</span><span class="nx">volume</span><span class="p">);</span>
    <span class="p">},</span>
    
    <span class="nx">getFragment</span><span class="o">:</span> <span class="kd">function</span><span class="p">(</span><span class="nx">url</span><span class="p">)</span> <span class="p">{</span>
        <span class="k">if</span> <span class="p">(</span><span class="nx">url</span><span class="p">.</span><span class="nx">indexOf</span><span class="p">(</span><span class="s2">&quot;#&quot;</span><span class="p">)</span> <span class="o">!=</span> <span class="o">-</span><span class="mi">1</span> <span class="o">&amp;&amp;</span> <span class="nx">url</span><span class="p">.</span><span class="nx">indexOf</span><span class="p">(</span><span class="s2">&quot;#&quot;</span><span class="p">)</span> <span class="o">&lt;</span> <span class="nx">url</span><span class="p">.</span><span class="nx">length</span> <span class="o">-</span><span class="mi">1</span><span class="p">)</span> <span class="p">{</span>
            <span class="k">return</span> <span class="nx">url</span><span class="p">.</span><span class="nx">substr</span><span class="p">(</span><span class="nx">url</span><span class="p">.</span><span class="nx">indexOf</span><span class="p">(</span><span class="s2">&quot;#&quot;</span><span class="p">)</span><span class="o">+</span><span class="mi">1</span><span class="p">);</span>
        <span class="p">}</span>
        <span class="k">return</span> <span class="s2">&quot;&quot;</span><span class="p">;</span>
    <span class="p">},</span>
    <span class="nx">stripFragment</span><span class="o">:</span> <span class="kd">function</span><span class="p">(</span><span class="nx">url</span><span class="p">)</span> <span class="p">{</span>
        <span class="k">if</span> <span class="p">(</span><span class="nx">url</span><span class="p">.</span><span class="nx">indexOf</span><span class="p">(</span><span class="s2">&quot;#&quot;</span><span class="p">)</span> <span class="o">==</span> <span class="o">-</span><span class="mi">1</span><span class="p">)</span> <span class="p">{</span>
            <span class="k">return</span> <span class="nx">url</span><span class="p">;</span>
        <span class="p">}</span>
        <span class="k">else</span> <span class="p">{</span>
            <span class="k">return</span> <span class="nx">url</span><span class="p">.</span><span class="nx">substr</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="nx">url</span><span class="p">.</span><span class="nx">indexOf</span><span class="p">(</span><span class="s2">&quot;#&quot;</span><span class="p">));</span>
        <span class="p">}</span>
    <span class="p">}</span>
<span class="p">});</span>

</pre></div> </td> </tr> </tbody> </table> </div> </body> </html>
Something went wrong with that request. Please try again.