MCPcopy Create free account
hub / github.com/boost-ext/di / writeURL

Function writeURL

doc/cppnow-2016/js/reveal.js:3247–3281  ·  view source on GitHub ↗

* Updates the page URL (hash) to reflect the current * state. * * @param {Number} delay The time in ms to wait before * writing the hash

( delay )

Source from the content-addressed store, hash-verified

3245 * writing the hash
3246 */
3247 function writeURL( delay ) {
3248
3249 if( config.history ) {
3250
3251 // Make sure there's never more than one timeout running
3252 clearTimeout( writeURLTimeout );
3253
3254 // If a delay is specified, timeout this call
3255 if( typeof delay === 'number' ) {
3256 writeURLTimeout = setTimeout( writeURL, delay );
3257 }
3258 else if( currentSlide ) {
3259 var url = '/';
3260
3261 // Attempt to create a named link based on the slide's ID
3262 var id = currentSlide.getAttribute( 'id' );
3263 if( id ) {
3264 id = id.replace( /[^a-zA-Z0-9\-\_\:\.]/g, '' );
3265 }
3266
3267 // If the current slide has an ID, use that as a named link
3268 if( typeof id === 'string' && id.length ) {
3269 url = '/' + id;
3270 }
3271 // Otherwise use the /h/v index
3272 else {
3273 if( indexh > 0 || indexv > 0 ) url += indexh;
3274 if( indexv > 0 ) url += '/' + indexv;
3275 }
3276
3277 window.location.hash = url;
3278 }
3279 }
3280
3281 }
3282
3283 /**
3284 * Retrieves the h/v location of the current, or specified,

Callers 2

slideFunction · 0.70
syncFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected