2014-09-30 22:20:37 +00:00
$ ( document ) . ready ( function ( ) {
2015-02-06 11:39:10 +00:00
$ ( 'a.logout' ) . bind ( 'click' , function ( e ) {
e . preventDefault ( ) ;
var target = $ ( this ) . attr ( 'href' ) ;
$ . confirm ( {
'title' : 'Logout' ,
'message' : 'Are you sure you want to Logout from SickGear ?' ,
'buttons' : {
'Yes' : {
'class' : 'green' ,
'action' : function ( ) {
location . href = target ;
}
} ,
'No' : {
'class' : 'red' ,
'action' : function ( ) { } // Nothing to do in this case. You can as well omit the action property.
}
}
} ) ;
} ) ;
$ ( 'a.shutdown' ) . bind ( 'click' , function ( e ) {
2014-09-30 22:20:37 +00:00
e . preventDefault ( ) ;
var target = $ ( this ) . attr ( 'href' ) ;
$ . confirm ( {
'title' : 'Shutdown' ,
2014-11-12 16:43:14 +00:00
'message' : 'Are you sure you want to shutdown SickGear ?' ,
2014-09-30 22:20:37 +00:00
'buttons' : {
'Yes' : {
'class' : 'green' ,
'action' : function ( ) {
location . href = target ;
}
} ,
'No' : {
'class' : 'red' ,
'action' : function ( ) { } // Nothing to do in this case. You can as well omit the action property.
}
}
} ) ;
} ) ;
2015-02-06 11:39:10 +00:00
$ ( 'a.restart' ) . bind ( 'click' , function ( e ) {
2014-09-30 22:20:37 +00:00
e . preventDefault ( ) ;
var target = $ ( this ) . attr ( 'href' ) ;
$ . confirm ( {
'title' : 'Restart' ,
2014-11-12 16:43:14 +00:00
'message' : 'Are you sure you want to restart SickGear ?' ,
2014-09-30 22:20:37 +00:00
'buttons' : {
'Yes' : {
'class' : 'green' ,
'action' : function ( ) {
location . href = target ;
}
} ,
'No' : {
'class' : 'red' ,
'action' : function ( ) { } // Nothing to do in this case. You can as well omit the action property.
}
}
} ) ;
} ) ;
2014-10-29 13:41:18 +00:00
2015-02-06 11:39:10 +00:00
$ ( 'a.remove' ) . bind ( 'click' , function ( e ) {
2014-09-30 22:20:37 +00:00
e . preventDefault ( ) ;
var target = $ ( this ) . attr ( 'href' ) ;
2015-02-06 11:39:10 +00:00
var showname = document . getElementById ( 'showtitle' ) . getAttribute ( 'data-showname' ) ;
2014-09-30 22:20:37 +00:00
$ . confirm ( {
'title' : 'Remove Show' ,
Add choose to delete watched episodes from a list of played media at Kodi, Emby, and/or Plex.
Add episode watched state system that integrates with Kodi, Plex, and/or Emby, instructions at Shows/History/Layout/"Watched".
Add installable SickGear Kodi repository containing addon "SickGear Watched State Updater".
Change add Emby setting for watched state scheduler at Config/Notifications/Emby/"Update watched interval".
Change add Plex setting for watched state scheduler at Config/Notifications/Plex/"Update watched interval".
Add API cmd=sg.updatewatchedstate, instructions for use are linked to in layout "Watched" at /history.
Change history page table filter input values are saved across page refreshes.
Change history page table filter inputs, accept values like "dvd or web" to only display both.
Change history page table filter inputs, press 'ESC' key inside a filter input to reset it.
Add provider activity stats to Shows/History/Layout/ drop down.
Change move provider failures table from Manage/Media Search to Shows/History/Layout/Provider fails.
Change sort provider failures by most recent failure, and with paused providers at the top.
Change remove table form non-testing version 20007, that was reassigned.
2018-03-06 01:18:08 +00:00
'message' : 'Are you sure you want to remove <span class="footerhighlight">' + showname + '</span> from the database ?<br /><br /><input type="checkbox" id="delete-files"> <span class="red-text">Check to delete files as well. IRREVERSIBLE</span>' ,
2014-09-30 22:20:37 +00:00
'buttons' : {
'Yes' : {
'class' : 'green' ,
'action' : function ( ) {
Add choose to delete watched episodes from a list of played media at Kodi, Emby, and/or Plex.
Add episode watched state system that integrates with Kodi, Plex, and/or Emby, instructions at Shows/History/Layout/"Watched".
Add installable SickGear Kodi repository containing addon "SickGear Watched State Updater".
Change add Emby setting for watched state scheduler at Config/Notifications/Emby/"Update watched interval".
Change add Plex setting for watched state scheduler at Config/Notifications/Plex/"Update watched interval".
Add API cmd=sg.updatewatchedstate, instructions for use are linked to in layout "Watched" at /history.
Change history page table filter input values are saved across page refreshes.
Change history page table filter inputs, accept values like "dvd or web" to only display both.
Change history page table filter inputs, press 'ESC' key inside a filter input to reset it.
Add provider activity stats to Shows/History/Layout/ drop down.
Change move provider failures table from Manage/Media Search to Shows/History/Layout/Provider fails.
Change sort provider failures by most recent failure, and with paused providers at the top.
Change remove table form non-testing version 20007, that was reassigned.
2018-03-06 01:18:08 +00:00
location . href = target + ( document . getElementById ( 'delete-files' ) . checked ? '&full=1' : '' ) ;
2014-10-29 13:41:18 +00:00
// If checkbox is ticked, remove show and delete files. Else just remove show.
2014-09-30 22:20:37 +00:00
}
} ,
'No' : {
'class' : 'red' ,
'action' : function ( ) { } // Nothing to do in this case. You can as well omit the action property.
}
}
} ) ;
} ) ;
Add choose to delete watched episodes from a list of played media at Kodi, Emby, and/or Plex.
Add episode watched state system that integrates with Kodi, Plex, and/or Emby, instructions at Shows/History/Layout/"Watched".
Add installable SickGear Kodi repository containing addon "SickGear Watched State Updater".
Change add Emby setting for watched state scheduler at Config/Notifications/Emby/"Update watched interval".
Change add Plex setting for watched state scheduler at Config/Notifications/Plex/"Update watched interval".
Add API cmd=sg.updatewatchedstate, instructions for use are linked to in layout "Watched" at /history.
Change history page table filter input values are saved across page refreshes.
Change history page table filter inputs, accept values like "dvd or web" to only display both.
Change history page table filter inputs, press 'ESC' key inside a filter input to reset it.
Add provider activity stats to Shows/History/Layout/ drop down.
Change move provider failures table from Manage/Media Search to Shows/History/Layout/Provider fails.
Change sort provider failures by most recent failure, and with paused providers at the top.
Change remove table form non-testing version 20007, that was reassigned.
2018-03-06 01:18:08 +00:00
$ ( '#del-watched' ) . bind ( 'click' , function ( e ) {
e . preventDefault ( ) ;
var dedupe = [ ] , delArr = [ ] , mFiles = 0 ;
$ ( '.del-check' ) . each ( function ( ) {
if ( ! 0 === this . checked ) {
var pathFile = $ ( this ) . closest ( 'tr' ) . attr ( 'data-file' ) ,
thisId = $ ( this ) . attr ( 'id' ) ;
if ( - 1 === jQuery . inArray ( pathFile , dedupe ) ) {
dedupe . push ( pathFile ) ;
mFiles += 1 - $ ( this ) . closest ( 'tr' ) . find ( '.tvShow .strike-deleted' ) . length ;
}
delArr . push ( thisId . replace ( 'del-' , '' ) ) ;
/** @namespace $.SickGear.history.isCompact */
if ( $ . SickGear . history . isCompact ) {
// then select all related episode checkboxes
var tvepId = $ ( this ) . closest ( 'tr' ) . attr ( 'data-tvep-id' ) ;
$ ( 'tr[data-tvep-id="' + tvepId + '"] input.del-check:not("#' + thisId + '")' )
. each ( function ( ) {
delArr . push ( $ ( this ) . attr ( 'id' ) . replace ( 'del-' , '' ) ) ;
} ) ;
}
}
} ) ;
if ( 0 === delArr . length )
return ! 1 ;
/** @namespace $.SickGear.history.isTrashit */
/** @namespace $.SickGear.history.lastDeleteFiles */
/** @namespace $.SickGear.history.lastDeleteRecords */
var action = $ . SickGear . history . isTrashit ? 'Trash' : 'Delete' ,
btns = {
'Yes' : {
'class' : 'green' ,
'action' : function ( ) {
var deleteFiles = ! ! $ ( '#delete-files:checked' ) . length ,
deleteRecords = ! ! $ ( '#delete-records:checked' ) . length ,
checked = ' checked="checked"' ;
$ . SickGear . history . lastDeleteFiles = deleteFiles ? checked : '' ;
$ . SickGear . history . lastDeleteRecords = deleteRecords ? checked : '' ;
$ . post ( $ . SickGear . Root + '/history/watched' ,
{
2018-04-02 23:05:13 +00:00
_xsrf : Cookies . get ( '_xsrf' ) ,
Add choose to delete watched episodes from a list of played media at Kodi, Emby, and/or Plex.
Add episode watched state system that integrates with Kodi, Plex, and/or Emby, instructions at Shows/History/Layout/"Watched".
Add installable SickGear Kodi repository containing addon "SickGear Watched State Updater".
Change add Emby setting for watched state scheduler at Config/Notifications/Emby/"Update watched interval".
Change add Plex setting for watched state scheduler at Config/Notifications/Plex/"Update watched interval".
Add API cmd=sg.updatewatchedstate, instructions for use are linked to in layout "Watched" at /history.
Change history page table filter input values are saved across page refreshes.
Change history page table filter inputs, accept values like "dvd or web" to only display both.
Change history page table filter inputs, press 'ESC' key inside a filter input to reset it.
Add provider activity stats to Shows/History/Layout/ drop down.
Change move provider failures table from Manage/Media Search to Shows/History/Layout/Provider fails.
Change sort provider failures by most recent failure, and with paused providers at the top.
Change remove table form non-testing version 20007, that was reassigned.
2018-03-06 01:18:08 +00:00
tvew _id : delArr . join ( '|' ) ,
files : ( deleteFiles ? '1' : '' ) ,
records : ( deleteRecords ? '1' : '' )
} ,
function ( data ) {
var result = $ . parseJSON ( data ) ;
result . success && window . location . reload ( true ) ;
/ * u s i n g w i n d o w . l o c a t i o n a s t h e f o l l o w i n g i s
sluggish when deleting 20 of 100 records
* /
/ *
result . success && $ . each ( result . success , function ( ) {
var tr = $ ( '#del-' + this ) . closest ( 'tr' ) ;
var t = tr . closest ( 'table' ) ;
tr . addClass ( 'delete-me' ) . fadeToggle ( 'fast' , 'linear' ) . promise ( ) . done (
function ( ) {
$ ( '.delete-me' ) . html ( '' ) ;
t . trigger ( 'update' ) ;
$ . SickGear . sumChecked ( ) ;
} ) ;
} ) ; * /
} ) ;
}
}
} ;
// btn pre-created here in order to use a custom btn text as named key to object
btns [ 'No' + ( 0 < mFiles ? ', abort ' + ( $ . SickGear . history . isTrashit ? 'trash' : 'permanent delete' ) : '' ) ] = { 'class' : 'red' } ;
$ . confirm ( {
'title' : ( action + ( 0 < mFiles ? ' media' : ' records' )
+ '<span style="float:right;font-size:12px">(<a class="highlight-text contrast-text" href="/config/general/">"Send to trash" options</a>)</span>' ) ,
'message' : ( 0 < mFiles
? '<input id="delete-files" style="margin-right:6px"' + $ . SickGear . history . lastDeleteFiles + ' type="checkbox">'
+ '<span>' + action + ' <span class="footerhighlight">' + mFiles + '</span>'
+ ' media file' + ( 1 === mFiles ? '' : 's' ) + ' from disk</span>'
: ''
)
+ '<span style="display:block;margin-top:20px">'
+ '<input id="delete-records" style="margin-right:6px"' + $ . SickGear . history . lastDeleteRecords + ' type="checkbox">'
+ 'Remove <span class="footerhighlight">'
+ delArr . length + '</span> history record' + ( 1 === delArr . length ? '' : 's' )
+ '</span>'
+ '<span class="red-text" style="display:block;margin-top:20px">Are you sure ?</span>' ,
'buttons' : btns
} ) ;
} ) ;
2015-02-06 11:39:10 +00:00
$ ( 'a.clearhistory' ) . bind ( 'click' , function ( e ) {
2014-09-30 22:20:37 +00:00
e . preventDefault ( ) ;
var target = $ ( this ) . attr ( 'href' ) ;
$ . confirm ( {
'title' : 'Clear History' ,
'message' : 'Are you sure you want to clear all download history ?' ,
'buttons' : {
'Yes' : {
'class' : 'green' ,
'action' : function ( ) {
location . href = target ;
}
} ,
'No' : {
'class' : 'red' ,
'action' : function ( ) { } // Nothing to do in this case. You can as well omit the action property.
}
}
} ) ;
} ) ;
Add choose to delete watched episodes from a list of played media at Kodi, Emby, and/or Plex.
Add episode watched state system that integrates with Kodi, Plex, and/or Emby, instructions at Shows/History/Layout/"Watched".
Add installable SickGear Kodi repository containing addon "SickGear Watched State Updater".
Change add Emby setting for watched state scheduler at Config/Notifications/Emby/"Update watched interval".
Change add Plex setting for watched state scheduler at Config/Notifications/Plex/"Update watched interval".
Add API cmd=sg.updatewatchedstate, instructions for use are linked to in layout "Watched" at /history.
Change history page table filter input values are saved across page refreshes.
Change history page table filter inputs, accept values like "dvd or web" to only display both.
Change history page table filter inputs, press 'ESC' key inside a filter input to reset it.
Add provider activity stats to Shows/History/Layout/ drop down.
Change move provider failures table from Manage/Media Search to Shows/History/Layout/Provider fails.
Change sort provider failures by most recent failure, and with paused providers at the top.
Change remove table form non-testing version 20007, that was reassigned.
2018-03-06 01:18:08 +00:00
2015-02-06 11:39:10 +00:00
$ ( 'a.trimhistory' ) . bind ( 'click' , function ( e ) {
2014-09-30 22:20:37 +00:00
e . preventDefault ( ) ;
var target = $ ( this ) . attr ( 'href' ) ;
$ . confirm ( {
'title' : 'Trim History' ,
'message' : 'Are you sure you want to trim all download history older than 30 days ?' ,
'buttons' : {
'Yes' : {
'class' : 'green' ,
'action' : function ( ) {
location . href = target ;
}
} ,
'No' : {
'class' : 'red' ,
'action' : function ( ) { } // Nothing to do in this case. You can as well omit the action property.
}
}
} ) ;
} ) ;
Add choose to delete watched episodes from a list of played media at Kodi, Emby, and/or Plex.
Add episode watched state system that integrates with Kodi, Plex, and/or Emby, instructions at Shows/History/Layout/"Watched".
Add installable SickGear Kodi repository containing addon "SickGear Watched State Updater".
Change add Emby setting for watched state scheduler at Config/Notifications/Emby/"Update watched interval".
Change add Plex setting for watched state scheduler at Config/Notifications/Plex/"Update watched interval".
Add API cmd=sg.updatewatchedstate, instructions for use are linked to in layout "Watched" at /history.
Change history page table filter input values are saved across page refreshes.
Change history page table filter inputs, accept values like "dvd or web" to only display both.
Change history page table filter inputs, press 'ESC' key inside a filter input to reset it.
Add provider activity stats to Shows/History/Layout/ drop down.
Change move provider failures table from Manage/Media Search to Shows/History/Layout/Provider fails.
Change sort provider failures by most recent failure, and with paused providers at the top.
Change remove table form non-testing version 20007, that was reassigned.
2018-03-06 01:18:08 +00:00
} ) ;