# HG changeset patch # User veltr # Date 1358266611 -3600 # Node ID 4bdadca1cd5a84e716dbad1e24e14cf52b0aa4a0 # Parent be1c7b812f558acdd04f3998eed91c4ecbfb11d1 Now uses sort by weight option and unloads unnecessary video files diff -r be1c7b812f55 -r 4bdadca1cd5a integration/css/theend.css --- a/integration/css/theend.css Wed Jan 09 16:51:45 2013 +0100 +++ b/integration/css/theend.css Tue Jan 15 17:16:51 2013 +0100 @@ -583,3 +583,10 @@ .lightBoxScroll h4 { font-weight: bold; } + +/* METANAV COMPENSATION */ + +.metanav { + position: fixed !important; + z-index: 1000; +} diff -r be1c7b812f55 -r 4bdadca1cd5a integration/js/tagplayer.js --- a/integration/js/tagplayer.js Wed Jan 09 16:51:45 2013 +0100 +++ b/integration/js/tagplayer.js Tue Jan 15 17:16:51 2013 +0100 @@ -3,7 +3,8 @@ project = directory.remoteSource({ url: IriSP.endpoints.mashup_by_tag, url_params: { - tag: opts.tag + tag: '"' + opts.tag + '"', + sort: "weight" }, serializer: IriSP.serializers.ldt }), @@ -13,7 +14,9 @@ currentSegment, currentMedia, globalTags = {}, - seqCount; + seqCount, + mediasInDom = [], + MAX_LOADED_VIDEOS = 2; var ratio = 2.37; @@ -238,9 +241,7 @@ return; } mashup.getMedias().forEach(function(m) { - m.show = function() { - addMedia(m); - } + addMedia(m); }); seqCount = mashup.segments.length; var html = mashup.segments.map(function(s, i) { @@ -285,6 +286,19 @@ currentIndex = n; currentSegment = mashup.segments[n].annotation; currentMedia = currentSegment.getMedia(); + var followingMedias = []; + for (var i = n; i < mashup.segments.length; i++) { + followingMedias.push(mashup.segments[i].getMedia()); + } + followingMedias = _(followingMedias).uniq().slice(0, MAX_LOADED_VIDEOS); + var mediasToRemove = _(mediasInDom).difference(followingMedias); + _(mediasToRemove).each(function(m) { + m.removeFromDom(); + }); + followingMedias = _(followingMedias).difference(mediasInDom); + _(followingMedias).each(function(m) { + m.addToDom(); + }); mashup.getMedias().forEach(function(m) { if (m === currentMedia) { m.show(); @@ -292,6 +306,7 @@ m.hide(); } }); + console.log("There are now",mediasInDom.length,'~',$("video").length,"