@ -12,45 +12,49 @@ var header = $("header"),
loading = $ ( "#loading" ) ,
infobox = $ ( "#infobox" ) ,
api _path = "php/api.php" ,
version = "1.0. 1 ";
version = "1.0. 2 ";
$ ( document ) . ready ( function ( ) {
/* Event Name */
if ( mobileBrowser ( ) ) event _name = "touchend" ;
else event _name = "click" ;
/* Login */
$ ( "#password" ) . live ( "keyup" , function ( ) {
if ( $ ( this ) . val ( ) . length > 0 ) $ ( this ) . removeClass ( "error" ) ;
} ) ;
/* Add Dialog */
$ ( ".button_add" ) . live ( "click" , function ( ) { $ ( "body" ) . append ( buildAddModal ) } ) ;
$ ( "#add_album" ) . live ( "click" , addAlbum ) ;
$ ( "#add_photo" ) . live ( "click" , function ( ) { $ ( "#auswahl" ) . html ( "" ) ; $ ( "#upload_files" ) . click ( ) } ) ;
$ ( ".button_add" ) . live ( event _name , function ( ) { $ ( "body" ) . append ( buildAddModal ) } ) ;
$ ( "#add_album" ) . live ( event _name , addAlbum ) ;
$ ( "#add_photo" ) . live ( event _name , function ( ) { $ ( "#auswahl" ) . html ( "" ) ; $ ( "#upload_files" ) . click ( ) } ) ;
/* Toolbar Buttons */
$ ( "#button_signout" ) . live ( "click" , function ( ) {
$ ( "#button_signout" ) . live ( event _name , function ( ) {
modal = buildModal ( "Sign Out" , "Are you sure you want to leave and log out?" , [ "Sign out" , "Stay here" ] , [ "logout();" , "" ] ) ;
$ ( "body" ) . append ( modal ) ;
} ) ;
$ ( "#button_download" ) . live ( "click" , function ( ) {
$ ( "#button_download" ) . live ( event _name , function ( ) {
link = $ ( "#image_view #image" ) . css ( "background-image" ) . replace ( /"/g , "" ) . replace ( /url\(|\)$/ig , "" ) ;
window . open ( link , "_newtab" ) ;
} ) ;
$ ( "#button_move" ) . live ( "click" , function ( e ) {
$ ( "#button_move" ) . live ( event _name , function ( e ) {
showContextMenuMove ( image _view . attr ( "data-id" ) , e . pageX , e . pageY ) ;
} ) ;
$ ( "#button_trash_album" ) . live ( "click" , function ( ) {
$ ( "#button_trash_album" ) . live ( event _name , function ( ) {
if ( content . attr ( "data-id" ) == "0" ) deleteUnsorted ( ) ;
else deleteAlbum ( ) ;
} ) ;
$ ( "#button_trash" ) . live ( "click" , function ( ) { deletePhoto ( ) } ) ;
$ ( "#button_edit_album" ) . live ( "click" , function ( ) { renameAlbum ( ) } ) ;
$ ( "#button_edit" ) . live ( "click" , function ( ) { renamePhoto ( ) } ) ;
$ ( "#button_info" ) . live ( "click" , function ( ) { showInfobox ( ) } ) ;
$ ( "#button_archive" ) . live ( "click" , function ( ) { getAlbumArchive ( ) } ) ;
$ ( "#button_sync" ) . live ( "click" , function ( ) { syncFolder ( ) } ) ;
$ ( "#button_trash" ) . live ( event _name , function ( ) { deletePhoto ( ) } ) ;
$ ( "#button_edit_album" ) . live ( event _name , function ( ) { renameAlbum ( ) } ) ;
$ ( "#button_edit" ) . live ( event _name , function ( ) { renamePhoto ( ) } ) ;
$ ( "#button_info" ) . live ( event _name , function ( ) { showInfobox ( ) } ) ;
$ ( "#button_archive" ) . live ( event _name , function ( ) { getAlbumArchive ( ) } ) ;
$ ( "#button_sync" ) . live ( event _name , function ( ) { syncFolder ( ) } ) ;
/* Rename Album/Photo via Titlebar */
$ ( "#title.editable" ) . live ( "click" , function ( ) {
$ ( "#title.editable" ) . live ( event _name , function ( ) {
if ( visibleImageview ( ) ) renamePhoto ( ) ; else renameAlbum ( ) ;
} ) ;
@ -59,15 +63,15 @@ $(document).ready(function(){
e . preventDefault ( ) ;
showContextMenuPhoto ( $ ( this ) . attr ( "data-id" ) , e . pageX , e . pageY ) ;
} ) ;
$ ( ".contextmenu_bg" ) . live ( "click" , closeContextMenu ) ;
$ ( ".contextmenu_bg" ) . live ( event _name , closeContextMenu ) ;
/* Star/Share Photo */
$ ( "#button_star" ) . live ( "click" , setPhotoStar ) ;
$ ( "#button_share" ) . live ( "click" , function ( e ) {
$ ( "#button_star" ) . live ( event _name , setPhotoStar ) ;
$ ( "#button_share" ) . live ( event _name , function ( e ) {
if ( $ ( "#button_share a.active" ) . length ) showContextMenuShare ( image _view . attr ( "data-id" ) , e . pageX , e . pageY ) ;
else setPhotoPublic ( e ) ;
} ) ;
$ ( ".copylink" ) . live ( "click" , function ( ) { $ ( this ) . select ( ) } ) ;
$ ( ".copylink" ) . live ( event _name , function ( ) { $ ( this ) . select ( ) } ) ;
/* Upload */
$ ( "#upload_files" ) . live ( "change" , function ( ) {
@ -84,19 +88,19 @@ $(document).ready(function(){
$ ( ".photo" ) . live ( "click" , function ( ) { setURL ( "a" + content . attr ( "data-id" ) + "p" + $ ( this ) . attr ( "data-id" ) ) } ) ;
/* Nav Back */
$ ( "#button_back_home" ) . live ( "click" , function ( ) { setURL ( "" ) } ) ;
$ ( "#button_back" ) . live ( "click" , function ( ) { setURL ( "a" + content . attr ( "data-id" ) ) } ) ;
$ ( "#button_back_home" ) . live ( event _name , function ( ) { setURL ( "" ) } ) ;
$ ( "#button_back" ) . live ( event _name , function ( ) { setURL ( "a" + content . attr ( "data-id" ) ) } ) ;
/* Close Modal */
$ ( ".message a.close" ) . live ( "click" , closeModal ) ;
$ ( ".message a.close" ) . live ( event _name , closeModal ) ;
/* Image View */
$ ( "#image_view a#previous" ) . live ( "click" , loadPreviousPhoto ) ;
$ ( "#image_view a#next" ) . live ( "click" , loadNextPhoto ) ;
$ ( "#image_view a#previous" ) . live ( event _name , loadPreviousPhoto ) ;
$ ( "#image_view a#next" ) . live ( event _name , loadNextPhoto ) ;
/* Infobox */
$ ( "#infobox_overlay, #infobox .header a" ) . live ( "click" , function ( ) { hideInfobox ( ) } ) ;
$ ( "#edit_description" ) . live ( "click" , function ( ) { setPhotoDescription ( ) } ) ;
$ ( "#infobox_overlay, #infobox .header a" ) . live ( event _name , function ( ) { hideInfobox ( ) } ) ;
$ ( "#edit_description" ) . live ( event _name , function ( ) { setPhotoDescription ( ) } ) ;
/* Window */
$ ( window ) . keydown ( key ) ;
@ -105,7 +109,7 @@ $(document).ready(function(){
$ ( window ) . bind ( "mouseenter" , showControls ) ;
/* Init */
if ( ( BrowserDetect . browser == "Explorer" ) || ( BrowserDetect . browser == "Safari" && BrowserDetect . version < 5 ) || ( BrowserDetect . browser == "Chrome" && BrowserDetect . version < 18 ) || ( BrowserDetect . browser == "Firefox" && BrowserDetect . version < 1 4 ) ) {
if ( ( BrowserDetect . browser == "Explorer" ) || ( BrowserDetect . browser == "Safari" && BrowserDetect . version < 5 ) || ( BrowserDetect . browser == "Chrome" && BrowserDetect . version < 18 ) || ( BrowserDetect . browser == "Firefox" && BrowserDetect . version < 1 5 ) ) {
modal = buildModal ( "Browser not supported" , "You are currently using an outdated or unsupported Browser. This site might not work properly. Please consider to update your Browser!" , [ "Leave" ] , [ "location.href = 'http://browsehappy.com';" ] ) ;
$ ( "body" ) . append ( modal ) ;