diff --git a/couchpotato/static/scripts/reloader.js b/couchpotato/static/scripts/reloader.js new file mode 100644 index 00000000..3a4eec8c --- /dev/null +++ b/couchpotato/static/scripts/reloader.js @@ -0,0 +1,24 @@ +var ReloaderBase = new Class({ + + initialize: function(){ + var self = this; + + App.on('watcher.changed', self.reloadFile.bind(self)) + + }, + + reloadFile: function(data){ + var self = this, + urls = data.data; + + urls.each(function(url){ + var without_timestamp = url.split('?')[0], + old_links = document.getElement('[data-url^=\''+without_timestamp+'\']'); + + old_links.set('href', old_links.get('href') + 1) + }) + } + +}); + +var Reloader = new ReloaderBase();