diff options
author | Nils Jansen <nilsjansen@gmail.com> | 2012-03-23 18:41:30 +0400 |
---|---|---|
committer | Nils Jansen <nilsjansen@gmail.com> | 2012-03-23 18:41:30 +0400 |
commit | ceb102555fa12d70a1fcb010b6225f708e37138b (patch) | |
tree | 100e9a13ff6a3358119e2a3918f52367041fea9a /files_sgfviewer | |
parent | 488a50650b521ec107e0ad33ee50bc95c4824cdc (diff) |
added correct breadcrumb and cleaned up code
Diffstat (limited to 'files_sgfviewer')
-rw-r--r-- | files_sgfviewer/js/viewer.js | 91 | ||||
-rw-r--r-- | files_sgfviewer/js/viewer.js~ | 56 |
2 files changed, 106 insertions, 41 deletions
diff --git a/files_sgfviewer/js/viewer.js b/files_sgfviewer/js/viewer.js index 165a02e8c..b2cd373d2 100644 --- a/files_sgfviewer/js/viewer.js +++ b/files_sgfviewer/js/viewer.js @@ -1,50 +1,59 @@ function viewSgf(dir, file) { - //tinker a valid sgf URL for the eidogo lib - var location=window.location.protocol+"//"+document.domain+OC.filePath('files','ajax','download.php')+'?files='+file+'&dir='+dir; - - // fade out file list - $('table').fadeOut('slow').promise().done(function(){; - - // inject div container to load the player - var sgfviewer ='<div id="player-container" style="margin-top:45px;"></div>'; - $('table').after(sgfviewer); - - // load sgf player - var player = new eidogo.Player({ - container:"player-container", - theme:"standard", - sgfUrl: location, - enableShortcuts: true, - problemMode: false, - showComments: true, - showPlayerInfo: true, - showGameInfo: true, - showTools: true, - markCurrent: true, - markVariations: true - }); - }); + //tinker a valid sgf URL for the eidogo lib + var location= window.location.protocol+ + "//"+document.domain+ + OC.filePath('files','ajax','download.php')+ + '?files='+file+'&dir='+dir; + + $('.actions,#file_action_panel').fadeOut('slow').promise().done(function() { + // sgf action toolbar + var sgfToolbarHtml = '<div class="crumb last">'+file+'</div>'; + // Change breadcrumb classes + $('#controls .last').removeClass('last'); + $('#controls').append(sgfToolbarHtml); + }); + + + // fade out file list + $('table').fadeOut('slow').promise().done(function(){; + // inject div container to load the player + var sgfviewer ='<div id="player-container" style="margin-top:45px;"></div>'; + $('table').after(sgfviewer); + + // load sgf player + var player = new eidogo.Player({ + container:"player-container", + theme:"standard", + sgfUrl: location, + enableShortcuts: true, + problemMode: false, + showComments: true, + showPlayerInfo: true, + showGameInfo: true, + showTools: true, + markCurrent: true, + markVariations: true + }); + }); } + // do the file manager file extension recognition magic $(document).ready(function() { - if(typeof FileActions!=='undefined'){ - - var supportedMimes = new Array( - 'application/sgf'); - for (var i = 0; i < supportedMimes.length; ++i){ - var mime = supportedMimes[i]; - FileActions.register(mime,'View','',function(filename){ - viewSgf($('#dir').val(),filename); - }); - FileActions.setDefault(mime,'View'); - } - } - - $('#sgf_close').live('click',function() { - closeSgfViewer(); - }); + if(typeof FileActions!=='undefined'){ + + var supportedMimes = new Array( + 'application/sgf'); + for (var i = 0; i < supportedMimes.length; ++i){ + var mime = supportedMimes[i]; + FileActions.register(mime,'View','',function(filename){ + viewSgf($('#dir').val(),filename); + }); + FileActions.setDefault(mime,'View'); + } + } + }); diff --git a/files_sgfviewer/js/viewer.js~ b/files_sgfviewer/js/viewer.js~ new file mode 100644 index 000000000..dd1068e8b --- /dev/null +++ b/files_sgfviewer/js/viewer.js~ @@ -0,0 +1,56 @@ +function viewSgf(dir, file) { + + //tinker a valid sgf URL for the eidogo lib + var location=window.location.protocol+"//"+document.domain+OC.filePath('files','ajax','dow$ + + $('.actions,#file_action_panel').fadeOut('slow').promise().done(function() { + // sgf action toolbar + var sgfToolbarHtml = '<div class="crumb last">'+file+'</div>'; + // Change breadcrumb classes + $('#controls .last').removeClass('last'); + $('#controls').append(sgfToolbarHtml); + }); + + + // fade out file list + $('table').fadeOut('slow').promise().done(function(){; + // inject div container to load the player + var sgfviewer ='<div id="player-container" style="margin-top:45px;"></div>'; + $('table').after(sgfviewer); + + // load sgf player + var player = new eidogo.Player({ + container:"player-container", + theme:"standard", + sgfUrl: location, + enableShortcuts: true, + problemMode: false, + showComments: true, + showPlayerInfo: true, + showGameInfo: true, + showTools: true, + markCurrent: true, + markVariations: true + }); + }); + +} + + +// do the file manager file extension recognition magic +$(document).ready(function() { + if(typeof FileActions!=='undefined'){ + + var supportedMimes = new Array( + 'application/sgf'); + for (var i = 0; i < supportedMimes.length; ++i){ + var mime = supportedMimes[i]; + FileActions.register(mime,'View','',function(filename){ + viewSgf($('#dir').val(),filename); + }); + FileActions.setDefault(mime,'View'); + } + } + +}); + |