Bugzilla – Bug 1734
right pane refresh during player selection
Last modified: 2009-09-08 09:19:01 UTC
problem: when you change the player you want to control using the drop down menu, the right pane is refreshed to home...this is particularly frustrating if you had already navigated to a selection before realizing that the wrong player was selected in the menu. solution: not refreshing the right pane when you select a player.
The left side must be refreshed in order to have the proper player links in all of the urls. However, it might be possible to refresh to the current page instead of home.
Probably won't be fixed for 6.1.
KDF - do you have cookie code to handle this?
Theere is cookie code in the fishbone skin. html/scripts.js that grabs the last selected browse page. For use as a general skin cookie, it would need a bit of tweaking. The player id is added as a separate process, so that helps. When is the date for 6.2 again?
September 30th
ok, the existing code should work. it needs a better calling mechanism for this application. The setting of it will be a bit different, since I use it as a form action. In most skins, it will have to be tied to the click of the links. Not too hard, just needs some thought and testing. I can ponder it for a while. should be plenty of time if you want to pop this to me.
javascript: function loadAgain(newPlayer) { for(var i=0;i < top.frames.length; i++){ var myString = new String(top.frames[i].location) var rString = "player=" + newPlayer; var rExp = /player\=.*(\&?)/gi; var newString = myString.replace(rExp, rString + "$1"); top.frames[i].location = newString; alert (newString); } } usage: <form><td align="left"> <select name="player" onchange="setCookie('SlimServer-player',this.form.player.value); loadAgain(this.form.player.value); " class="stdedit">[% player_chooser_list %]</select> </td></form> strangely, this ONLY seems to work when the last alert() is inluded in the script. very annoying!! without it, the page always goes back to the top level browse. anyone have any ideas?
ah...nevermind. stupid remnant onload in another frame was getting in the way. final javascript looks like this: function loadAgain(newPlayer) { for(var i=0;i < top.frames.length; i++){ var myString = new String(top.frames[i].location); var rString = "player=" + newPlayer; var rExp = /player\=.*(\&?)(.*?)/gi; top.frames[i].location = myString.replace(rExp, rString + "$1$2"); } } as a result, for Default skin, we just need to change the switchPlayer javascript to: function switchPlayer(player_List){ var newPlayer = player_List.options[player_List.selectedIndex].value; for(var i=0;i < top.frames.length; i++){ var myString = new String(top.frames[i].location); var rString = "player=" + newPlayer; var rExp = /player\=.*(\&?)(.*?)/gi; top.frames[i].location = myString.replace(rExp, rString + "$1$2"); } }
a better version of the script with a tighter regex to replace JUST the player MAC: function switchPlayer(player_List){ var newPlayer = player_List.options[player_List.selectedIndex].value; for(var i=0;i < top.frames.length; i++){ var myString = new String(top.frames[i].location); var rString = newPlayer; var rExp = /(\w\w(:|%3A)){5}(\w\w)/gi; top.frames[i].location = myString.replace(rExp, rString); } }
Commited as subversion change 4377 Thanks!
It seems that this causes a problem when the urls have commands associated with them. The direct replace of frame urls should probably ONLY be done for playlist.html,browse*.html and setup.html I'm not sure if checking the url would be more complete/faster than going through every link in the DOM to replace the player component.
I think something like this for the loop should work: for(var i=0;i < top.frames.length; i++){ for (var j=0;j < top.frames[i].document.links.length; j++){ var myString = new String(top.frames[i].document.links[j].href); var rString = newPlayer; var rExp = /(\w\w(:|%3A)){5}(\w\w)/gi; top.frames[i].document.links[j].href = myString.replace(rExp, rString); } } Firefox seems to think it is ok, but IE (surprise!) needs to be kicked around a bit more.
adding this line above the loop takes care of reloading the playlist page. benefit of all of this, no refresh of the frames is required. Safari still needs to be tested.
Created attachment 887 [details] reload status, playlist and reset hrefs for browser frame This is hopefully the best of both worlds. The status_header and the playlist are both reloaded with no command params and the new player uri. whatever is in the browser side is rewritten via the DOM to change the player component of the hrefs.
fixed again in trunk change 4532