MCPcopy Create free account
hub / github.com/cfinke/Channel-Two / refreshProgramming

Function refreshProgramming

channel-two.js:1160–1174  ·  view source on GitHub ↗

* Re-fetch the JavaScript file that was generated from the cron schedule, which updates * the local `programming` variable. This allows the schedule to be changed without having * to reload the page, which would require a new click interaction to keep playing.

()

Source from the content-addressed store, hash-verified

1158 * to reload the page, which would require a new click interaction to keep playing.
1159 */
1160 function refreshProgramming() {
1161 if ( logLevel >= 3 ) console.log( "refreshProgramming()" );
1162
1163 // Reload the programming.js JavaScript by removing the script tag and adding a new one with a cache-buster.
1164
1165 const script = document.createElement( 'script' );
1166 script.src = 'programming.js?t=' + ( new Date().getTime() );
1167 script.setAttribute( 'id', 'programming' );
1168
1169 $( '#programming' ).remove();
1170 document.body.appendChild(script);
1171
1172 // Clean up our stored durations to avoid using more space than we need.
1173 purgeDurations();
1174 }
1175
1176 /**
1177 * Encode the individual directories and filenames in a path without encoding the slashes.

Callers

nothing calls this directly

Calls 1

purgeDurationsFunction · 0.85

Tested by

no test coverage detected