Compare commits

...

42 Commits

Author SHA1 Message Date
hummypkg
3ca87e1285 update webif
git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@2114 2a923420-c742-0410-a762-8d5b09965624
2015-01-05 21:59:36 +00:00
hummypkg
777ff469b9 bump version
git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@2100 2a923420-c742-0410-a762-8d5b09965624
2015-01-04 21:07:08 +00:00
hummypkg
86ab612ea3 fix content_code
git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@2099 2a923420-c742-0410-a762-8d5b09965624
2015-01-04 21:06:44 +00:00
hummypkg
2744a91ec7 use dbfetch for consistent order
git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@2094 2a923420-c742-0410-a762-8d5b09965624
2014-12-30 19:48:40 +00:00
hummypkg
85fed3247a show usb disk space. Clickable log viewer
git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@2093 2a923420-c742-0410-a762-8d5b09965624
2014-12-30 19:00:15 +00:00
hummypkg
51aded3d2d fix usb eject with virtual-disk2
git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@2092 2a923420-c742-0410-a762-8d5b09965624
2014-12-30 14:56:45 +00:00
hummypkg
5d0939d8de Add eject, more context icons, fix some HTML issues, update jquery
git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@2090 2a923420-c742-0410-a762-8d5b09965624
2014-12-29 22:28:51 +00:00
hummypkg
fcb036801e fixes
git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@2089 2a923420-c742-0410-a762-8d5b09965624
2014-12-21 23:33:22 +00:00
hummypkg
d962ada7e5 fix log ack
git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@2088 2a923420-c742-0410-a762-8d5b09965624
2014-12-18 22:33:50 +00:00
hummypkg
3f52c3063a services update
git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@2087 2a923420-c742-0410-a762-8d5b09965624
2014-12-17 23:55:31 +00:00
hummypkg
bf94690223 new log viewer
git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@2084 2a923420-c742-0410-a762-8d5b09965624
2014-12-17 23:02:55 +00:00
hummypkg
8516f21c18 add tablesorter2 plugin
git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@2083 2a923420-c742-0410-a762-8d5b09965624
2014-12-17 19:37:17 +00:00
hummypkg
9d69328615 re-add
git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@2078 2a923420-c742-0410-a762-8d5b09965624
2014-12-05 22:57:49 +00:00
hummypkg
14fb5f7c76 rm
git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@2077 2a923420-c742-0410-a762-8d5b09965624
2014-12-05 22:56:15 +00:00
hummypkg
788f613a5b sortable disk utilisation page. Better pie chart click handling
git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@2075 2a923420-c742-0410-a762-8d5b09965624
2014-12-05 22:36:03 +00:00
hummypkg
1c9da2f52f update
git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@2068 2a923420-c742-0410-a762-8d5b09965624
2014-11-29 11:39:24 +00:00
hummypkg
37efb8d633 tweaks
git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@2064 2a923420-c742-0410-a762-8d5b09965624
2014-11-27 22:26:36 +00:00
hummypkg
294598faf6 misc updates
git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@2062 2a923420-c742-0410-a762-8d5b09965624
2014-11-09 20:24:44 +00:00
hummypkg
1116a3f050 diskspace tweaks
git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@2056 2a923420-c742-0410-a762-8d5b09965624
2014-10-18 21:43:02 +00:00
hummypkg
67ffdc8105 new pie chart
git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@2055 2a923420-c742-0410-a762-8d5b09965624
2014-10-15 19:31:43 +00:00
hummypkg
04fe30145d updates
git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@2054 2a923420-c742-0410-a762-8d5b09965624
2014-10-14 22:08:31 +00:00
hummypkg
61f3868c42 minor tweaks
git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@2053 2a923420-c742-0410-a762-8d5b09965624
2014-10-13 12:32:02 +00:00
hummypkg
987425b22a change connectivity test
git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@2047 2a923420-c742-0410-a762-8d5b09965624
2014-10-08 00:25:31 +00:00
hummypkg
c886f6afd2 versioned backups + change folder for pending
git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@2044 2a923420-c742-0410-a762-8d5b09965624
2014-10-07 21:23:15 +00:00
hummypkg
e6d7af1fc4 1.0.17 RC
git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@2041 2a923420-c742-0410-a762-8d5b09965624
2014-10-07 00:49:22 +00:00
hummypkg
0691577b96 fix mkdir
git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@2035 2a923420-c742-0410-a762-8d5b09965624
2014-09-13 09:00:17 +00:00
hummypkg
876d5b5e8a add force dedup process
git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@2033 2a923420-c742-0410-a762-8d5b09965624
2014-09-04 22:34:30 +00:00
hummypkg
4d895e464d check connectivity
git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@2030 2a923420-c742-0410-a762-8d5b09965624
2014-08-28 18:44:42 +00:00
hummypkg
252d6bf7f6 revert iphone-style-checkboxes and re-patch for actual width calculations
git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@2023 2a923420-c742-0410-a762-8d5b09965624
2014-07-23 19:16:58 +00:00
hummypkg
ea03a67b4a adding
git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@2021 2a923420-c742-0410-a762-8d5b09965624
2014-07-21 22:01:10 +00:00
hummypkg
3adbeb987a 1.0.16
git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@2020 2a923420-c742-0410-a762-8d5b09965624
2014-07-21 21:55:28 +00:00
hummypkg
23fdc62b81 fix icon paths with spaces
git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@2018 2a923420-c742-0410-a762-8d5b09965624
2014-07-09 21:34:50 +00:00
hummypkg
b88691c9e5 add channelicons, fix status, show more actions
git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@2017 2a923420-c742-0410-a762-8d5b09965624
2014-07-08 18:30:02 +00:00
hummypkg
3c4b907091 pass processed file list to plugins
git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@2016 2a923420-c742-0410-a762-8d5b09965624
2014-07-07 22:06:57 +00:00
hummypkg
1c00e63f48 fix bookmarks, add serial number
git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@2012 2a923420-c742-0410-a762-8d5b09965624
2014-07-06 20:11:59 +00:00
hummypkg
59006ff474 ladd
git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@1986 2a923420-c742-0410-a762-8d5b09965624
2014-06-25 19:51:30 +00:00
hummypkg
616c0afff1 updates
git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@1983 2a923420-c742-0410-a762-8d5b09965624
2014-06-23 20:14:23 +00:00
hummypkg
84899871e1 1.0.15-3
git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@1981 2a923420-c742-0410-a762-8d5b09965624
2014-06-19 21:34:48 +00:00
hummypkg
ed042ee230 bug fixes
git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@1979 2a923420-c742-0410-a762-8d5b09965624
2014-06-19 18:50:53 +00:00
hummypkg
3c44ec33f9 fix dedup inuse problem
git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@1975 2a923420-c742-0410-a762-8d5b09965624
2014-06-17 08:49:04 +00:00
hummypkg
02d7bc3f33 bookmark management
git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@1974 2a923420-c742-0410-a762-8d5b09965624
2014-06-16 21:14:37 +00:00
hummypkg
492b37be41 1.0.15 & improved status
git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@1968 2a923420-c742-0410-a762-8d5b09965624
2014-06-14 09:21:09 +00:00
147 changed files with 2482 additions and 399 deletions

View File

@@ -1,10 +1,10 @@
Package: webif
Priority: optional
Section: web
Version: 1.0.14-10
Version: 1.2.0
Architecture: mipsel
Maintainer: af123@hummypkg.org.uk
Depends: webif-channelicons(>=1.1.11),lighttpd(>=1.4.35-2),jim(>=0.75-1),jim-oo,jim-sqlite3(>=0.75),jim-cgi(>=0.7),jim-binary(>=0.75),service-control(>=1.2),busybox(>=1.20.2-1),lsof(>=4.87),epg(>=1.0.13),hmt(>=1.1.19),ssmtp,anacron,trm(>=1.1),openssl-command,nicesplice,id3v2,file,rsvsync(>=1.0.2),webif-charts(>=1.2-1),stripts(>=1.2.5-3),smartmontools,tmenu(>=1.08),ffmpeg,id3v2,multienv(>=1.6),mongoose
Depends: webif-channelicons(>=1.1.14),lighttpd(>=1.4.35-2),jim(>=0.75-1),jim-oo,jim-sqlite3(>=0.75),jim-cgi(>=0.7),jim-binary(>=0.75),service-control(>=2.1),busybox(>=1.20.2-1),lsof(>=4.87),epg(>=1.2.0),hmt(>=1.2.0),ssmtp,anacron,trm(>=1.1),openssl-command,nicesplice,id3v2,file,rsvsync(>=1.0.2),webif-charts(>=1.2-1),stripts(>=1.2.5-3),smartmontools,tmenu(>=1.08),ffmpeg,id3v2,multienv(>=1.6),tcpping(>=1.1),e2fsprogs,mongoose
Suggests:
Description: An evolving web interface for the Humax.
Tags: http://hummy.tv/forum/threads/5031/
Tags: http://hummy.tv/forum/threads/5866/

View File

@@ -49,6 +49,11 @@ fi
/mod/webif/lib/bin/diskattrs
#/mod/webif/lib/bin/resetnew
# Remove hook script placed by the legacy rt3070 package which does not work
# with CFW >= 3.00
hook=/mod/boot/xinit.d/rt3070
[ -f $hook ] && rm -f $hook
[ -f $tmpf ] && rm -f $tmpf
exit 0

View File

@@ -3,7 +3,7 @@
package require cgi
package require sqlite3
source /mod/webif/lib/setup
require altrow progressbar epg.class
require altrow progressbar epg.class system.class
header
@@ -51,7 +51,7 @@ foreach tw [$db query {
"
puts "<td>[progressbar $ucLevel]</td>"
puts "<td>[progressbar $ucQuality]</td>"
puts "<td>[string range $netName 3 end]</td>"
puts "<td>[system strip $netName]</td>"
set channels [$db query {
select usLcn, szSvcName, szPrvName, aucDefaultAuthority
@@ -64,7 +64,7 @@ foreach tw [$db query {
set ehs 0
foreach chan $channels {
lassign $chan x lcn x name
set name [string range $name 1 end]
set name [system strip $name]
if {$lcn >= 800} { incr ehs }
switch $name {
"BBC THREE" { set mux "PSB1/BBC A" }
@@ -73,7 +73,7 @@ foreach tw [$db query {
"BBC ONE HD" { set mux "PSB3/BBC B" }
"ITV3" { set mux "COM4/SDN" }
"Dave" { set mux "COM5/ARQ A" }
"Film4+1" { set mux "COM6/ARQ B" }
"ITV4" { set mux "COM6/ARQ B" }
"BBC NEWS HD" { set mux "COM7/ARQ C" }
"Movies4Men" { set mux "Local" }
}
@@ -104,8 +104,8 @@ foreach tw [$db query {
altrow reset
foreach chan $channels {
lassign $chan x lcn x name x prv x auth
set name [string range $name 1 end]
set prv [string range $prv 3 end]
set name [system strip $name]
set prv [system strip $prv]
altrow
puts "
<td class=va>[epg channelicon $name 50]</td>

View File

@@ -62,7 +62,7 @@ proc db_info {db_file} {
if {$fdb == 0} {
puts "Please choose database to view:<ul>"
foreach db $databases {
foreach db [lsort $databases] {
puts "<li><a href=$::env(SCRIPT_NAME)?db=[file tail $db]>
$db</a></li>"
}

View File

@@ -72,10 +72,16 @@ puts "
"
if {[$record get warning] != ""} {
if {[$record get warning_mode]} {
set gcol red
} else {
set gcol blue
}
puts "
<tr>
<th>Warning</th>
<td>[$record get warning]</td>
<td><img class=va src=/img/Guidance_$gcol.png height=21>
[$record get warning]</td>
</tr>
"
}

View File

@@ -70,6 +70,7 @@ if {[llength $records] > 0} {
<th colspan=3>Channel</th>
<th>Programme</th>
<th>Synopsis</th>
<th></th>
</tr>
}
} else {

15
webif/cgi-bin/hximages.jim Executable file
View File

@@ -0,0 +1,15 @@
#!/mod/bin/jimsh
source /mod/webif/lib/setup
header
puts "<ul>"
foreach f [readdir "/opt/share/images/blue"] {
if {![string match {*.png} $f]} continue
puts "<li><img src=\"/images/$f\">$f</li>"
}
puts "</ul>"

View File

@@ -2,7 +2,7 @@
package require cgi
source /mod/webif/lib/setup
require pkg.class
require pkg.class system.class
cgi_input
#cgi_dump
@@ -10,27 +10,40 @@ cgi_input
set cmd [cgi_get cmd update]
proc opkg {cmd} {
puts ">>> opkg $cmd\r\n"
puts ">>> opkg $cmd"
set bcmd "|/mod/webif/lib/bin/opkg $cmd"
set fd [open $bcmd r]
while {[gets $fd line] >= 0} {
puts "$line\r\n"
puts "$line"
}
close $fd
puts "\r\n"
puts ""
}
httpheader "text/plain"
if {$cmd eq "upgrade"} { opkg update }
opkg $cmd
set cmdargs [lassign $cmd cmd]
if {$cmd eq "update" || $cmd eq "upgrade"} {
puts "Updating package meta information\r\n"
pkg fetchmeta
puts "Done.\r\n"
puts "Updating diagnostic meta information\r\n"
pkg fetchdiagmeta
puts "Done.\r\n"
set netcmds {install update upgrade}
if {$cmd in $netcmds && ![system connectivity]} {
puts ""
puts "!! ERROR - No network connectivity to package repository !!"
puts ""
puts "Check your Internet connection and DNS service and then try again."
exit
}
if {$cmd eq "upgrade"} { opkg update }
opkg "$cmd $cmdargs"
if {$cmd eq "update" || $cmd eq "upgrade"} {
puts "Updating package meta information"
pkg fetchmeta
puts "Done."
puts ""
puts "Updating diagnostic meta information"
pkg fetchdiagmeta
puts "Done."
}

View File

@@ -19,6 +19,12 @@ switch $runmode {
}
}
if {"-d" in $argv} {
proc debug {arg} { puts $arg }
} else {
proc debug {arg} {}
}
if {[catch {set pid [exec pgrep -n humaxtv]}]} {
puts "Cannot find humaxtv process."
exit
@@ -27,21 +33,13 @@ if {[catch {set pid [exec pgrep -n humaxtv]}]} {
set exts {.ts .mkv .avi .mpg .mpeg .wmv .mp3 .mp4 .mov}
proc get_data {} {
global pid exts
global pid exts opfile
set ret {}
if {[catch {set data \
[exec /mod/webif/lib/bin/lsof -X -Fns -p $pid]} msg]} {
set ret {}
} else {
#aw
#s583700480
#n/mnt/hd2/My Video/Real Lives Reunited_20140610_1002.ts
# Unfortunately, the access flag isn't reliable for
# some reason. If it were, the sleep could be removed!
set size 0
foreach line [split $data "\n"] {
set typ [string index $line 0]
@@ -73,47 +71,121 @@ proc get_data {} {
}
}
}
if {$opfile ne "" && $opfile ni $ret} {
set ret($opfile) [file size $opfile]
}
}
return $ret
}
set play 0
set rec 0
set seen {}
set output {}
set opfile ""
if {[file exists "/mod/tmp/webif_auto/.op"} {
set fp [open "/mod/tmp/webif_auto/.op"]
lassign [split [string trim [$fp read]] ":"] op opfile
$fp close
debug "OP: $op - $opfile"
}
set data {}
if {$type eq "full"} {
set data [get_data]
}
if {[llength $data]} {
sleep 3
set ndata [get_data]
# puts " DATA: ($data)"
# puts " NDATA: ($ndata)"
foreach file [array names ndata] {
set bname [file rootname [file tail $file]]
if {![dict exists $seen $file]} { set seen($file) 0 }
if {![dict exists $data $file]} { set data($file) 0 }
if {[file exists "/mod/tmp/webif_auto/decrypting.$bname.ts"]} {
set mode "Decrypting"
set icon "178_1_00_Icon_Lock.png style=\"padding: 0 0.2em 0 0.5em\""
} elseif {$ndata($file) == -1} {
incr rec
incr play
set mode "Chase Playing"
set icon "745_1_11_Video_3REC_Live.png"
} elseif {$ndata($file) > $data($file) && $seen($file) < 1} {
incr rec
set mode "Recording"
set icon "745_1_11_Video_1REC.png"
} else {
incr play
set mode "Playing"
set icon "745_1_10_Video_2Live.png"
debug " DATA: ($data)"
if {![file exists /tmp/.rractive]} {
sleep 3
set ndata [get_data]
debug " NDATA: ($ndata)"
set rr 0
} else {
sleep 1
set ndata [get_data]
debug " NDATA: ($ndata)"
foreach k [array names data] {
if {![dict exists $ndata $k]} {
dict unset data $k
}
}
incr seen($file)
set rr 1
set recs {}
loop i 0 2 {
catch {
set fd [open "/tmp/.rec$i" r]
lappend recs "[$fd read -nonewline].ts"
$fd close
}
}
debug " RECS: $recs"
}
foreach file [array names data] {
set bname [file rootname [file tail $file]]
if {$file eq $opfile} {
set mode $op
} elseif {$data($file) == -1} {
set mode chase
} elseif {$rr} {
if {$file in $recs} {
set mode rec
} else {
set mode play
}
} else {
if {![dict exists $ndata $file]} continue
if {$ndata($file) > $data($file)} {
set mode rec
} else {
set mode play
}
}
switch $mode {
chase {
incr rec
incr play
set mode "Chase Playing"
set icon "745_1_11_Video_3REC_Live.png"
}
rec {
incr rec
set mode "Recording"
set icon "745_1_11_Video_1REC.png"
}
play {
incr play
set mode "Playing"
set icon "745_1_10_Video_2Live.png"
}
dec {
set mode "Decrypting"
set icon "/img/decrypt.png "
append icon "style=\"padding: 0 0.2em 0 0.5em\""
}
mpg {
set mode "Extracting MPG"
set icon "/img/mpg.png "
append icon "style=\"padding: 0 0.2em 0 0.5em\""
}
mp3 {
set mode "Extracting MP3"
set icon "/img/mp3.png "
append icon "style=\"padding: 0 0.2em 0 0.5em\""
}
shrink {
set mode "Shrinking"
set icon "/img/compress.png "
append icon "style=\"padding: 0 0.2em 0 0.5em\""
}
}
if {[string first "/" $icon] == -1} {
set icon "/images/$icon"
}
set name [string map {
"/mnt/hd2/My Video/" ""
@@ -125,7 +197,7 @@ if {[llength $data]} {
if {$runmode eq "cgi"} {
lappend output [concat \
"<span class=\"va stitem\">\n" \
" <img class=va src=/images/$icon>\n" \
" <img class=va src=$icon>\n" \
" <span>$mode&nbsp;<i>$name</i></span>\n" \
"</span>\n" \
]

29
webif/cgi-bin/usbeject.jim Executable file
View File

@@ -0,0 +1,29 @@
#!/mod/bin/jimsh
package require cgi
source /mod/webif/lib/setup
require system.class
httpheader "application/json"
set label [cgi_get label -]
foreach usb [system usbmounts 1] {
if {$usb(LABEL) eq $label} {
puts "{"
if {[catch {exec /bin/umount $usb(MP)} msg]} {
if {[string match {*resource busy*} $msg]} {
set msg "Failed to eject $label - in use"
}
puts "\"status\": 0,"
puts "\"result\": \"$msg\""
} else {
puts "\"status\": 1,"
puts "\"result\": \"Successfully ejected $label\""
catch {file delete -force $usb(MP)}
}
puts "}"
exit
}
}

35
webif/cgi-bin/usbinfo.jim Executable file
View File

@@ -0,0 +1,35 @@
#!/mod/bin/jimsh
source /mod/webif/lib/setup
require system.class
httpheader "application/json"
set fsg {File-Stor Gadget}
set ignoredev {}
if {[file isdirectory /mnt/hd2]} {
file stat /mnt/hd2 st
lappend ignoredev $st(dev)
}
puts "\["
set flag 0
foreach usb [system usbmounts 1] {
file stat $usb(MP) st
if {$usb(MODEL) ne $fsg && $st(dev) in $ignoredev} continue
if {$flag} { puts "," } else { set flag 1 }
puts " {"
set sf 0
foreach k [array names usb] {
if {$sf} { puts "," } else { set sf 1 }
puts -nonewline " \"$k\": \"$usb($k)\""
}
puts ""
puts -nonewline " }"
}
puts ""
puts "]"

View File

@@ -33,13 +33,19 @@ set fields [lsort [[rsv] vars]]
set data [split [read $fd] "\n"]
set ver 1
foreach line $data {
if {[string match "# version *" $line]} {
set ver [lindex [split $line " "] 2]
puts "Backup version $ver"
}
set vals [split $line "\t"]
if {[lindex $vals 0] ne "event"} { continue }
set vars {}
set i 0
foreach f $fields {
if {$f eq "aulEventToRecordInfo"} { continue }
if {$ver < 2 && $f eq "aulEventToRecordInfo"} continue
incr i
lappend vars $f [lindex $vals $i]
}

View File

@@ -9,8 +9,8 @@ puts {
<li class=cut><a href=#cut>Cut to clipboard</a></li>
<li class=pwcopy><a href=#copy>Copy to clipboard</a></li>
<li class=separator><a href=#rename>Rename</a></li>
<li><a href=#download>Download</a></li>
<li class="separator rename"><a href=#rename>Rename</a></li>
<li class=download><a href=#download>Download</a></li>
}
if {$model eq "HDR"} {
@@ -27,7 +27,9 @@ if {[system pkginst ffmpeg]} {
}
}
puts { <li><a href=#vthm>View Thumbnail</a></li> }
puts { <li class=thm><a href=#vthm>View Thumbnail</a></li> }
puts { <li class=bookmark><a href=#bmarks>Bookmarks</a></li> }
if $nicesplice {
puts {
@@ -36,8 +38,8 @@ if $nicesplice {
}
}
puts {
<li class=separator><a href=#lock>Toggle Lock</a></li>
<li><a href=#new>Toggle New</a></li>
<li class="separator lock"><a href=#lock>Toggle Lock</a></li>
<li class=new><a href=#new>Toggle New</a></li>
}
if {[llength $plugins(menu)]} {
@@ -55,8 +57,17 @@ puts {
<li class=cut><a href=#cut>Cut to clipboard</a></li>
<li class=pwcopy><a href=#copy>Copy to clipboard</a></li>
<li class=separator><a href=#rename>Rename</a></li>
<li><a href=#download>Download</a></li>
<li class="separator rename"><a href=#rename>Rename</a></li>
<li class="download"><a href=#download>Download</a></li>
}
if {[llength $plugins(omenu)]} {
foreach plugin $plugins(omenu) {
lassign $plugin tag options
puts "<li class=$tag><a href=#$tag>$options(desc)</a></li>"
}
}
puts {
</ul>
<ul id=dooptmenu class=contextMenu style="width: 250px">
@@ -72,10 +83,10 @@ puts {
<li class=cut><a href=#cut>Cut to clipboard</a></li>
<li class=pwcopy><a href=#copy>Copy to clipboard</a></li>
<li class=pwpaste><a href=#paste>Paste to folder</a></li>
<li class=separator><a href=#rename>Rename</a></li>
<li class="separator rename"><a href=#rename>Rename</a></li>
<li class=separator><a href=#resetnew>Reset new flag</a></li>
<li class="separator compress"><a href=#shrink>Auto-Shrink</a></li>
<li class="compressr"><a href=#shrinkr>Recursive Auto-Shrink</a></li>
<li class=compressr><a href=#shrinkr>Recursive Auto-Shrink</a></li>
<li class=dedup><a href=#dedup>Auto-Dedup</a></li>
}
if {$model eq "HDR"} {

View File

@@ -0,0 +1,49 @@
#!/mod/bin/jimsh
package require cgi
source /mod/webif/lib/setup
require ts.class pretty_size
jscss script.js style.css
jqplugin touchpunch
header
set rfile [cgi_get file]
set ts [ts fetch $rfile]
set dir [string map {' \\'} [file dirname $rfile]]
set erfile [string map {' \\'} $rfile]
set len [$ts duration 1]
puts "
<script type=text/javascript>
var initbookmarks = '[$ts bookmarks]';
var len = [$ts duration 1];
var file = '$erfile';
var dir = '$dir';
</script>
<fieldset class=cleft>
<legend>Manage Bookmarks</legend>
<table class=keyval cellpadding=5>
<tr><th>File:</th><td>$rfile</td></tr>
<tr><th>Length:</th><td>[clock format $len -format %T]</td></tr>
<tr><th>Size:</th><td>[pretty_size [$ts size]] ([$ts get definition])</td></tr>
<tr><th>Bookmarks<br><span class=footnote>(enter in seconds)</span></th><td>
<input id=bookmarks size=80 maxlength=255 init=\"[$ts bookmarks]\"
value=\"\" />
<button id=update>Update</button>
<br>
<span id=bookmarkstime></span>
</td></tr><tr><td align=right>
<button class=left id=addbmark>Add Bookmark</button>
<button class=left id=delbmark>Remove Bookmark</button>
</td><td><div id=slider></div></td></tr>
</table>
<div id=buttons>
<button id=save>Save Bookmarks</button>
<button id=back>Back to Media Browser</button>
</div>
<div id=results class=\"hidden blood\"></div>
"

View File

@@ -0,0 +1,20 @@
#!/mod/bin/jimsh
package require cgi
source /mod/webif/lib/setup
require ts.class
httpheader
set file [cgi_get file]
set bookmarks [cgi_get bookmarks ""]
if {[system inuse $file]} {
puts "This file is in use. Cannot process at the moment."
exit
}
set ts [ts fetch $file]
$ts setbookmarks [split [string trim $bookmarks]]
puts "Bookmarks saved successfully."

View File

@@ -0,0 +1,132 @@
var curval = 0;
var $slider;
function
setvals()
{
values = $.trim($('#bookmarks').val()).split(/ +/);
if (!values.length || values[0] == '')
{
refreshtimes();
return;
}
nvalues = [];
$.each(values, function(k, v) {
if (v > len)
v = len;
if (v < 0)
v = 0;
nvalues.push(v);
});
values = nvalues;
$('#bookmarks').val(values.join(' '));
sortmarks();
refreshtimes();
}
function
draw_slider()
{
if ($slider)
$slider.slider('destroy');
else
$slider = $('#slider');
setvals();
values = $.trim($('#bookmarks').val()).split(/ +/);
if (!values.length || values[0] == '')
{
$slider = null;
return;
}
$slider.slider({
min: 0,
max: len,
step: 1,
values: values,
start: function(event, ui) {
curval = ui.value;
},
stop: function(event, ui) {
curval = ui.value;
sortmarks();
refreshtimes();
},
slide: function(event, ui) {
var marks = '';
for (var i = 0; i < ui.values.length; ++i)
marks += ui.values[i] + ' ';
$('#bookmarks').val($.trim(marks));
setvals();
}
});
};
function
refreshtimes()
{
var t = '';
values = $.trim($('#bookmarks').val()).split(/ +/);
if (!values.length || values[0] == '')
{
$('#bookmarkstime').text(t);
return;
}
$.each(values, function(k, v) {
t += new Date(null, null, null, null, null, v)
.toTimeString().match(/\d{2}:\d{2}:\d{2}/)[0] + ' ';
});
$('#bookmarkstime').text(t);
}
function
sortmarks()
{
var a = $.trim($('#bookmarks').val()).split(/ +/);
a.sort(function(a, b){return a-b});
$('#bookmarks').val(a.join(" "));
}
$(function() {
$('#bookmarks').val($('#bookmarks').attr('init'));
draw_slider();
$('#addbmark').button({icons: {primary: "ui-icon-plus"}, text: false})
.on('click', function() {
$('#bookmarks').val('0 ' + $('#bookmarks').val());
draw_slider();
});
$('#delbmark').button({icons: {primary: "ui-icon-minus"}, text: false})
.on('click', function() {
var cur = $('#bookmarks').val();
cur = $.trim(cur.replace(
new RegExp('(^| )' + curval + '( |$)', ''), ' '));
$('#bookmarks').val(cur);
draw_slider();
});
$('#save').button({icons: {primary: "ui-icon-disk"}})
.on('click', function() {
$.post('save.jim', {
file: file,
bookmarks: $('#bookmarks').val()
}, function(data) {
$('#results').html(data)
.slideDown('slow').delay(5000).slideUp('slow');
});
});
$('#back').button({icons: {primary: "ui-icon-arrowreturnthick-1-w"}})
.on('click', function() {
window.location = '../index.jim?dir=' + dir;
});
$('#update').button()
.on('click', function() {
draw_slider();
});
});

View File

@@ -0,0 +1,16 @@
#slider
{
margin-top: 5px;
}
#buttons
{
margin-top: 5px;
}
#buttons2
{
margin-top: 5px;
}

View File

@@ -9,13 +9,14 @@ jscss crop.js
header
set rfile [cgi_get file]
set invert [cgi_get invert 0]
set ts [ts fetch $rfile]
set dir [file dirname $rfile]
set len [$ts duration 1]
puts "
<fieldset class=cleft>
<fieldset>
<legend>Crop recording</legend>
<table class=keyval cellpadding=5>
@@ -24,12 +25,9 @@ puts "
<tr><th>Size:</th><td>[pretty_size [$ts size]] ([$ts get definition])</td></tr>
<tr><th>Bookmarks:</th><td>[$ts get bookmarks] @ "
set flag 0
foreach b [$ts bookmarks] {
if $flag { puts -nonewline ", " }
incr flag
puts -nonewline [clock format $b -format "%T"]
}
puts [join [lmap i [$ts bookmarks 1] {
clock format $i -format "%T"
}] ", "]
puts "</td></tr><tr><th>File</th><td>"
@@ -41,10 +39,16 @@ proc div {type left right} {
$type</div>"
}
set bookmarks {}
if {$invert} {
append bookmarks "0 "
}
append bookmarks [$ts bookmarks]
set keeping 0
set last 0
set start -1
foreach b [$ts bookmarks] {
foreach b $bookmarks {
if {$start < 0} {
set start $b
continue
@@ -94,6 +98,7 @@ puts "
></span>
<div id=cropdiv style=\"padding: 1em\">
<button id=invert invert=$invert>Invert selection</button>
<button id=cropit>Perform crop operation</button>
</div>
@@ -101,9 +106,9 @@ puts "
Cropping: <div id=progressbar></div>
</div>
<button id=back class=hidden>Back to media list</button>
<button id=back>Back to media list</button>
<div id=output class=pre style=\"margin-top: 10px\"></div>
<div id=output class=\"hidden pre\" style=\"margin-top: 10px\"></div>
</fieldset>
"

View File

@@ -24,8 +24,9 @@ $('#cropit').button().click(function() {
$('#cropdiv').hide('slow');
$('#progressdiv').show('slow');
handle = setInterval("update()", 1000);
$('#output').text('Please do not interrupt...')
.load('execute.jim?file=' + $('#params').attr('file'),
$('#output').show().text('Please do not interrupt...')
.load('execute.jim?file=' + $('#params').attr('file') +
'&invert=' + $('#invert').attr('invert'),
function() {
clearInterval(handle);
handle = 0;
@@ -34,5 +35,10 @@ $('#cropit').button().click(function() {
});
});
$('#invert').button().on('click', function() {
window.location = 'crop.jim?file=' + $('#params').attr('file') +
'&invert=' + ($(this).attr('invert') == '1' ? '0' : '1');
});
});

View File

@@ -7,6 +7,7 @@ require ts.class pretty_size system.class
httpheader
set rfile [cgi_get file]
set invert [cgi_get invert]
if {[system inuse $rfile]} {
puts "This file is in use. Cannot process at the moment."
@@ -25,7 +26,7 @@ set origdir "$dir/_original"
if {![file exists $origdir]} { file mkdir $origdir }
set shname [file tail $base]
puts "Processing $shname"
puts "Processing $shname (inverted: $invert)"
if {[file exists "$origdir/$shname.ts"]} {
puts "This recording already exists within _original"
@@ -33,6 +34,8 @@ if {[file exists "$origdir/$shname.ts"]} {
exit
}
set bookmarks [$ts bookmarks]
puts "Moving recording to $origdir"
set tail [file tail $base]
@@ -42,17 +45,36 @@ foreach ext $tsgroup {
file rename "$base.$ext" "${origdir}/$tail.$ext"
}
puts [exec /mod/bin/nicesplice \
-in "$origdir/$shname" \
-out "$dir/$shname" \
-cutBookMarks]
set cmd [list /mod/bin/nicesplice \
-in "$origdir/$shname" \
-out "$dir/$shname"]
if {$invert} {
if {[expr [llength $bookmarks] % 2] != 0} {
lappend bookmarks [$ts duration 1]
}
foreach k [array names bookmarks] {
lappend cmd -cut $($k * 10) $($bookmarks($k) * 10)
}
} else {
lappend cmd "-cutBookMarks"
}
puts "CMD: $cmd"
puts [exec {*}$cmd]
#puts [exec /mod/bin/nicesplice \
# -in "$origdir/$shname" \
# -out "$dir/$shname" \
# -cutBookMarks]
set newname "$shname-[clock seconds]"
puts "Renaming file group to $newname"
ts renamegroup "$dir/$shname.ts" $newname
exec /mod/bin/hmt "+setfilename=$newname" "$dir/$newname.hmt"
# New nicesplice shrinks whilst cropping.
exec /mod/bin/hmt "+shrunk" "$dir/$newname.hmt"
# No longer required - nicesplice now sets this flag.
#exec /mod/bin/hmt "+shrunk" "$dir/$newname.hmt"
set croptime [expr [expr [clock milliseconds] - $cropstart] / 1000.0]
puts "Time taken: $croptime"

View File

@@ -38,7 +38,17 @@ if {$type eq "ts"} {
puts "
<th>Guidance</th>
<td><img class=va
src=/images/174_1_26_GuidancePolicy.png height=21>
src=/img/Guidance_red.png height=21>
[$ts get guidance]
</td>
</tr><tr>
"
}
if {[$ts flag "GGuidance"] > 0} {
puts "
<th>General Guidance</th>
<td><img class=va
src=/img/Guidance_blue.png height=21>
[$ts get guidance]
</td>
</tr><tr>
@@ -116,7 +126,10 @@ puts "</td>
<td>[$ts get flags]
"
if {[$ts get bookmarks]} {
puts " \[Bookmarks: [$ts get bookmarks]\]"
puts " \[Bookmarks: [$ts get bookmarks] @ [join \
[lmap i [$ts bookmarks 1] {
clock format $i -format "%T"
}] ", "]"
}
puts "</tr>"

View File

@@ -3,12 +3,12 @@
package require cgi
source /mod/webif/lib/setup
require ts.class pretty_size system.class settings.class escape browse.class \
plugin
plugin epg.class
jqplugin contextMenu bar enadis
jscss script.js style.css
set plugins { dmenu {} menu {} }
set plugins { dmenu {} menu {} omenu {} }
eval_plugins browse
header
@@ -17,7 +17,7 @@ set nicesplice [system pkginst nicesplice]
set flatten [system pkginst flatten]
set ignore {.nts .thm .hmi}
set include {.ts .avi .mpg .mpeg .wmv .mkv .mp3 .mp4 .mov .hmt}
set include {.ts .avi .mpg .mpeg .wmv .mkv .mp3 .mp4 .mov .hmt .m4v}
if {![dict exists $env SCRIPT_NAME]} {
set env(SCRIPT_NAME) ""
@@ -42,7 +42,7 @@ set model [system model]
set dustbin [system dustbin 1]
proc icon {img {hover ""} {extra ""} {class "va"}} {
puts -nonewline "<img src=$img class=\"$class\" height=21 $extra"
puts -nonewline "<img src=\"$img\" class=\"$class\" height=21 $extra"
if {$hover ne ""} {
puts -nonewline " alt=\"$hover\" title=\"$hover\""
}
@@ -177,6 +177,8 @@ proc entry {file} {{i 0}} {
if {$bfile in $dinuse} {
icon "/img/inuse.png"
}
icon [epg channeliconpath [$ts get channel_name]] \
[$ts get channel_name] "" "va browsechannel"
set genre [$ts get genre]
set glist [ts genrelist]
if {[dict exists $glist $genre]} {
@@ -219,7 +221,10 @@ proc entry {file} {{i 0}} {
# Guidance
if {[$ts flag "Guidance"] > 0} {
icon "/images/174_1_26_GuidancePolicy.png"
icon "/img/Guidance_red.png"
}
if {[$ts flag "GGuidance"] > 0} {
icon "/img/Guidance_blue.png"
}
# Indexed

View File

@@ -4,7 +4,7 @@ package require cgi
source /mod/webif/lib/setup
require ts.class pretty_size
jqplugin progressbar touchbridge
jqplugin progressbar touchpunch
jscss join.js join.css
header

View File

@@ -1,7 +1,11 @@
var plugins = {
menu: {},
dmenu: {}
menu_prepare: {},
omenu: {},
omenu_prepare: {},
dmenu: {},
dmenu_prepare: {}
};
var dir;
@@ -339,6 +343,18 @@ function preparemenu(el, menu)
$(menu).disableContextMenuItems('#new');
}
$.each(plugins.menu_prepare, function(k,v) {
plugins.menu_prepare[k](el, menu);
});
}
function prepareomenu(el, menu)
{
$(menu).enableContextMenuItems('#delete');
$.each(plugins.omenu_prepare, function(k,v) {
plugins.omenu_prepare[k](el, menu);
});
}
function fixdmenu(el, menu, flag, tag, descr, recurse)
@@ -388,6 +404,9 @@ function preparedmenu(el, menu)
fixdmenu(el, menu, 'autompg', '#mpg', 'Auto-mpg', 0);
fixdmenu(el, menu, 'automp3', '#mp3', 'Auto-audio', 0);
//fixdmenu(el, menu, 'autoexpire', '#expire', 'Auto-expire', 0);
$.each(plugins.dmenu_prepare, function(k,v) {
plugins.dmenu_prepare[k](el, menu);
});
}
function flagdir(file, flag, iconset, output, options)
@@ -479,6 +498,11 @@ var menuclick = function(action, el, pos)
$('#bmpdialogue').dialog('open');
break;
case 'bmarks':
window.location.href = '/browse/bookmarks/?file=' +
file;
break;
case 'download':
window.location.href = '/browse/download.jim?file=' +
file + '&base=' +
@@ -524,6 +548,31 @@ var menuclick = function(action, el, pos)
}
};
var omenuclick = function(action, el, pos)
{
switch (action)
{
case 'delete':
case 'copy':
case 'cut':
case 'rename':
case 'download':
menuclick(action, el, pos);
break;
default:
if (plugins.omenu[action])
{
var file = $(el).parent().prevAll('a.bf')
.last().attr('file');
plugins.omenu[action](file);
}
else
alert('Unhandled action: ' + action);
break;
}
};
var dmenuclick = function(action, el, pos)
{
var direl = $(el).parent().parent();
@@ -678,9 +727,9 @@ var dmenuclick = function(action, el, pos)
{
menu: 'ooptmenu',
leftButton: true,
beforeShow: preparemenu
beforeShow: prepareomenu
},
menuclick
omenuclick
);
$('img.dopt').contextMenu(

View File

@@ -68,6 +68,13 @@ div.container .middle
height: 116px;
}
div.container .usb
{
position: absolute;
left: -5px;
top: 8px;
}
div.footer
{
clear: both;
@@ -373,6 +380,7 @@ div.cut
div.toolbarouter
{
position: relative;
z-index: 29;
}
div.toolbar
@@ -394,6 +402,11 @@ div.toolbar
padding: 6px;
}
#status
{
width: 60%;
}
span.toolbarcell
{
float: left;
@@ -495,3 +508,39 @@ span.foldernum
border-bottom-left-radius: 1em;
}
#tbdiskspace
{
float: right;
padding-top: 1.2em;
position: relative;
right: -10px;
}
#tbdiskpie
{
float: right;
width: 150px;
height: 150px;
position: relative;
right: -10px;
}
.tbdiskpie
{
top: -10px !important;
}
#usbejectinfo
{
position: relative;
border: 1px solid #899caa;
box-shadow: 2px 2px 11px #666;
-moz-box-shadow: 2px 2px 11px #666;
-webkit-box-shadow: 2px 2px 11px #666;
border-radius: 5px;
-moz-border-radius: 5px;
background: #d2e0ea;
padding: 6px;
z-index: 40;
}

View File

@@ -72,8 +72,8 @@ foreach dir $dirs {
if {$doit} {
# Dooooo, it.
$ts settitle $syn
ts renamegroup $file $fn
$ts set_deduped
ts renamegroup $file $fn
}
}
}

View File

@@ -11,6 +11,7 @@ source process.jim
set dir [cgi_get dir "/media/My Video"]
set doit [cgi_get doit 0]
set reset [cgi_get reset 0]
jscss script.js
@@ -31,6 +32,11 @@ foreach file [readdir $dir] {
set file "$dir/$file"
if {[file extension $file] ne ".hmt"} { continue }
if {$reset} {
set ts [ts fetch $file 1]
$ts unset_deduped
}
set base [file tail [file rootname $file]]
lassign [dedupprocess $file] stat ts syn fn
@@ -69,8 +75,8 @@ foreach file [readdir $dir] {
if {$doit} {
# Dooooo, it.
$ts settitle $syn
ts renamegroup $file $fn
$ts set_deduped
ts renamegroup $file $fn
puts -nonewline "Done"
}
}
@@ -90,7 +96,11 @@ puts {
<button id=browse>Back to media browser</button>
}
if {!$doit} { puts "<button id=dedup>Process folder</button>" }
if {!$doit} {
puts "<button id=dedup>Process folder</button>"
} else {
puts "<button id=reset>Force re-processing of folder.</button>"
}
puts {
</small>

View File

@@ -17,8 +17,7 @@ proc dedupprocess {file} {{seen {}}} {
set base [file tail [file rootname $file]]
set syn [dedupnormalise [$ts get synopsis] [$ts get title]]
# Escape special characters to create the filename.
regsub -all -- {[\/ &]} $syn "_" fn
regsub -all -- {[?]} $fn "" fn
set fn [system filename $syn]
set stat ok
if {[$ts inuse]} {

View File

@@ -10,5 +10,9 @@ $('#dedup').button().click(function() {
window.location = window.location + '&doit=1';
});
$('#reset').button().click(function() {
window.location = window.location + '&reset=1';
});
});

View File

@@ -1,22 +0,0 @@
#!/mod/bin/jimsh
package require cgi
source /mod/webif/lib/setup
httpheader
set logdirs {/var/log /mod/tmp /mnt/hd3}
set logext {.log}
set log [cgi_get file 0]
set unlink [cgi_get unlink 0]
set ldir [file dirname $log]
if {[file dirname $log] in $logdirs && [file extension $log] in $logext} {
file copy -force "/dev/null" $log
if {$unlink} { file delete $log }
puts "Cleared $log"
exit
}
puts "Cannot clear $log"

View File

@@ -12,7 +12,6 @@ pkg loaddiagmeta
set smv [system modversion 1]
puts {
<fieldset class=cleft>
<legend>Utilities</legend>
@@ -25,8 +24,10 @@ puts {
<option value=0>-- Select diag or type name in box below --
}
foreach diag [array names ::diagmeta] {
puts "<option value=\"$diag\">$diag\n"
catch {
foreach diag [array names ::diagmeta] {
puts "<option value=\"$diag\">$diag\n"
}
}
puts {
@@ -165,14 +166,13 @@ View:
<legend>View Log Files</legend>
}
foreach file [lsort [concat \
[glob -nocomplain /var/log/*.log] \
[glob -nocomplain /mod/tmp/*.log] \
[glob -nocomplain /mnt/hd3/*.log] \
]] {
puts "<a href=# class=log file=\"$file\">
source /mod/webif/html/log/_lib.jim
foreach file [lsort -command logsort $loglist] {
puts "
<img border=0 height=14 src=/images/421_1_00_CH_Title_2R_Arrow.png>
[file tail $file]</a>
<a href=\"../log/?log=[cgi_quote_url $file]\">
[file tail $file]
</a>
(<span class=lsize>[pretty_size [file size $file]]</span>)
<a class=\"va footnote logclear\" href=# file=\"$file\">
<img class=va border=0 src=/img/close.png width=20>Clear</a>

View File

@@ -4,7 +4,7 @@ package require cgi
source /mod/webif/lib/setup
require system.class pretty_size
jqplugin easy-pie-chart
jqplugin easy-pie-chart sortelements
jscss script.js style.css
header
@@ -26,7 +26,7 @@ proc hasnew {dir} {
set rsize 0
proc gen {dir ddir {depth 0} {expand 0}} {
proc gen {dir ddir {depth 0} {expand 0}} {{i 0}} {
global root lroot rsize
if {[catch {set dsize [exec /mod/bin/busybox/du -s "$dir/"]} msg]} {
@@ -56,10 +56,12 @@ proc gen {dir ddir {depth 0} {expand 0}} {
set perc $($dsize * 100 / $rsize)
puts -nonewline "
<div class=\"va $class\" style=\"padding-left: ${depth}em\">
<div class=\"va $class dir\" size=$dsize sind=$i
style=\"padding-left: ${depth}em\">
<img border=0 class=\"va tlink\" src=/img/tree/$timg.png>
<span class=\"va fileperc\" data-percent=$perc>
<img border=0 class=va src=\"$img\"></span>
<img border=0 class=va src=\"$img\">
</span>
<span class=filesize>
([pretty_size $($dsize * 1024)] - $perc%)
</span>
@@ -71,6 +73,7 @@ proc gen {dir ddir {depth 0} {expand 0}} {
incr depth 2
incr expand -1
incr i
foreach subd $dlist { gen "$dir/$subd" $subd $depth $expand }
@@ -78,7 +81,7 @@ proc gen {dir ddir {depth 0} {expand 0}} {
}
puts {
<fieldset style="display: inline">
<fieldset class=cleft style="display: inline">
<legend> Disk Utilisation </legend>
}
@@ -86,6 +89,11 @@ gen $root "/" 0 2
puts {
</fieldset>
<div class=left>
<button id=sorta>Sort Alphabetically</button>
<br style="padding-top: 0.5em">
<button id=sorts>Sort by Size</button>
</div>
}
footer

View File

@@ -36,5 +36,36 @@ $('span.fileperc').easyPieChart({
lineCap: 'butt'
});
$('button').button();
String.prototype.toNum = function() {
return parseInt(this, 10);
}
function alphasort(a, b)
{
return $(a).attr('sind').toNum() > $(b).attr('sind').toNum() ? 1 : -1;
}
function sizesort(a, b)
{
return $(a).attr('size').toNum() < $(b).attr('size').toNum() ? 1 : -1;
}
function dosort(el, fn)
{
if ($(el).sortElements(fn).size())
dosort(el + ' > div.dir', fn);
}
$('#sorts').on('click', function() {
dosort('fieldset > div.dir', sizesort);
});
$('#sorta').on('click', function() {
dosort('fieldset > div.dir', alphasort);
});
});

View File

@@ -27,32 +27,6 @@ $('#runfopkg').click(function() {
});
});
$('a.log').click(function(e) {
e.preventDefault();
$('#results')
.slideDown()
.text('\n\nLoading log, please wait...\n\n')
.load('/cgi-bin/cat.jim?file=' +
encodeURIComponent($(this).attr('file')), function() {
$('#results').wrapInner('<pre>');
});
});
$('a.logclear').click(function(e) {
var t = $(this);
e.preventDefault();
if (!confirm('Delete ' + $(this).attr('file') + '?'))
return;
$('#results')
.slideDown()
.text('\n\nClearing log, please wait...\n\n')
.load('clearlog.jim?file=' +
encodeURIComponent($(this).attr('file')), function() {
$('#results').wrapInner('<pre>');
$(t).prev('span.lsize').html('0 bytes');
});
});
$('#runedit').click(function(e) {
e.preventDefault();
window.location = '/edit/edit.jim';
@@ -121,6 +95,21 @@ $('#runrma').click(function(e) {
});
});
$('a.logclear').click(function(e) {
var t = $(this);
e.preventDefault();
if (!confirm('Delete ' + $(this).attr('file') + '?'))
return;
$('#results')
.slideDown()
.text('\n\nClearing log, please wait...\n\n')
.load('/log/act.jim?action=clear&file=' +
encodeURIComponent($(this).attr('file')), function() {
$('#results').wrapInner('<pre>');
$(t).prev('span.lsize').html('0 bytes');
});
});
});

View File

@@ -0,0 +1,71 @@
#!/mod/bin/jimsh
source /mod/webif/lib/setup
require system.class pretty_size
lassign [system diskspace 1] size used perc free fperc tsrbuf tsrused
# Calculate the TSR reserve
set tsrreserve $($tsrbuf - $tsrused)
# Adjust values to account for the TSR reserve
set free $($free - $tsrreserve)
set used $($size - $free)
set dbs 0
if {[system pkginst undelete]} {
set dbs [system dustbinsize]
set used $($used - $dbs)
}
set uperc $($used * 100 / $size)
set dperc $($dbs * 100 / $size)
set fperc $(100 - $uperc - $dperc)
set usedstr [pretty_size $used]
set freestr [pretty_size $free]
set dbsstr [pretty_size $dbs]
puts "
<script type=text/javascript>
diskspace_data = \[
{
name: 'Used',
y: $used,
sliced: false,
pretty: '$usedstr'
},
{
name: 'Dustbin',
y: $dbs,
sliced: false,
pretty: '$dbsstr'
},
{
name: 'Free',
y: $free,
sliced: false,
pretty: '$freestr'
}
];
</script>
<span id=tbdiskpie></span>
"
puts "
<span id=tbdiskspace>
Total space: [pretty_size $size]<br>
<img src=/img/pie-blue.png height=10>
Used: $usedstr ($uperc%)<br>
<img src=/img/pie-grey.png height=10>
Free: $freestr ($fperc%)
"
if {$dbs} {
puts "<br>
<img src=/img/pie-yellow.png height=10>
Dustbin: $dbsstr ($dperc%)"
}
puts "
</span>
<script src=/diskspace/diskspace.js type=text/javascript></script>
"

View File

@@ -0,0 +1,65 @@
//$(function () {
$('#tbdiskpie')
.hover(function(e) { e.stopPropagation(); $(this).stop(true, true); })
.highcharts({
chart: {
plotBackgroundColor: null,
plotBorderWidth: null,
backgroundColor: 'transparent',
plotShadow: false,
spacing: [0, 0, 0, 0],
className: 'tbdiskpie',
// height: 150, width: 150,
events: {
click: function(e) {
window.location = '/diag/dspace/index.jim';
}
}
},
// Blue #7cb5ec, Green #90ed7d
colors:
Highcharts.map(['#7cb5ec', '#e4d354', '#cccccc'], function(color) {
return {
radialGradient: { cx: 0.5, cy: 0.3, r: 0.7 },
stops: [
[0, color],
[1, Highcharts.Color(color).brighten(-0.3).get('rgb')]
]
};
}),
title: { text: '' },
credits: false,
plotOptions: {
pie: {
animation: { duration: 300 },
allowPointSelect: false,
cursor: 'pointer',
dataLabels: {
enabled: false
},
shadow: false,
borderWidth: 0,
states: { hover: false },
events: {
click: function(e) {
window.location = '/diag/dspace/index.jim';
}
}
}
},
tooltip: {
enabled: true,
formatter: function() {
return this.point.name + ': ' + this.point.pretty;
}
},
series: [{
type: 'pie',
name: 'Disk Space',
data: diskspace_data
}]
});
//});

View File

@@ -8,7 +8,12 @@ jqplugin enadis tabsupport filetree
jscss script.js style.css
header
set file [cgi_get file "/tmp/hosts"]
set file [cgi_get file -]
set backdesc [cgi_get backdesc "Back to diagnostics"]
set backlink [cgi_get backlink "/diag/diag.jim"]
if {$file ne "-"} {
puts "<script type=text/javascript>forcefile = '$file';</script>"
}
puts {
@@ -33,10 +38,12 @@ class="ui-widget ui-corner-all"></textarea>
</fieldset>
<div class=cleft>
<button id=back>Back to diagnostics</button>
}
puts "<button id=back dst=\"$backlink\">$backdesc</button>"
puts {
</div>
<div class=cleft style="margin-top: 1em">
<div id=qedit class=cleft style="margin-top: 1em">
<fieldset>
<legend> Commonly edited files </legend>
<ul>

View File

@@ -1,4 +1,6 @@
var forcefile = false;
$(function() {
var file = null;
@@ -100,8 +102,8 @@ $('#revert').click(function() {
});
$('#back').click(function() {
window.location = '/diag/diag.jim';
});
window.location = $(this).attr('dst');
});
function createf_submit()
{
@@ -148,4 +150,10 @@ $('a.qfile').on('click', function() {
loadfile($(this).text());
});
if (forcefile)
{
loadfile(forcefile);
$('#open,#create,#qedit').remove();
}
});

View File

@@ -17,7 +17,7 @@ require totop
require epg_popup
set service [cgi_get service 4351]
set records [epg fetch dump -service $service]
set records [epg dbfetch dump -service $service]
set tr [lindex $records 0]
$tr get_channel_info
@@ -55,10 +55,10 @@ puts {
<th>Time</th>
<th>Programme</th>
<th>Synopsis</th>
<th></th>
</tr>
}
set i 0
foreach record $records {
altrow
$record get_channel_info

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.4 KiB

BIN
webif/html/img/blank.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 42 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 642 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 684 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 536 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 845 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 901 B

BIN
webif/html/img/eject.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 396 B

BIN
webif/html/img/pie-blue.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.7 KiB

BIN
webif/html/img/pie-grey.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.7 KiB

BIN
webif/html/img/usb.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 678 B

File diff suppressed because one or more lines are too long

4
webif/html/js/jquery-1.11.2.min.js vendored Normal file

File diff suppressed because one or more lines are too long

View File

@@ -1 +1 @@
jquery-1.11.0.min.js
jquery-1.11.2.min.js

31
webif/html/js/toolbar.js Normal file
View File

@@ -0,0 +1,31 @@
var tb_lastupd = 0;
if (window.location.pathname != '/' &&
window.location.pathname != '/index.jim')
{
var down = function() {
$('#toolbar').stop(true, true).delay(200).slideDown(400,
function() {
if (+new Date() - tb_lastupd > 5000)
{
tb_lastupd = +new Date();
$('#tbstatus')
.empty()
.html('<img src=/img/loading.gif> ' +
'Updating...')
.load('/cgi-bin/status.jim');
}
});
};
var up = function() {
$('#toolbar').stop(true, true).delay(200).slideUp();
};
$('#topbar, #toolbar').hover(down, up);
$('span.toolbarcell').hover(
function() {
$(this).addClass('tbhover');
}, function() {
$(this).removeClass('tbhover');
});
}

10
webif/html/js/topbar.js Normal file
View File

@@ -0,0 +1,10 @@
$('#topbar').hover(
function() { $(this).css('cursor', 'pointer'); },
function() { $(this).css('cursor', 'auto'); }
);
$('#topbar a').on('click', function(e) {
e.stopPropagation();
});

99
webif/html/js/usbeject.js Normal file
View File

@@ -0,0 +1,99 @@
String.prototype.capitalise = function() {
return this.charAt(0).toUpperCase() + this.slice(1);
}
var usbeject_lastupd = 0;
var usbeject_visible = 0;
$('#usbeject').on('click', function(e) {
e.stopPropagation();
if (usbeject_visible)
{
$('#usbejectinfo').slideUp();
usbeject_visible = 0;
return;
}
if (+new Date() - usbeject_lastupd <= 5000)
{
$('#usbejectinfo').slideDown();
usbeject_visible = 1;
return;
}
usbeject_lastupd = +new Date();
$('#usbejecttab tbody').empty();
$('#usbejectout').html('<img src=/img/loading.gif> ' +
'<span class=blood>Scanning media...</span>');
usbeject_visible = 1;
$('#usbejectinfo').slideDown();
$.getJSON('/cgi-bin/usbinfo.jim', function(data) {
var num = 0;
$.each(data, function(k,v) {
num++;
var size = v.SIZE / 1000000000;
if (size >= 1000)
size = (size / 1000).toFixed(1) + "TB";
else
size = size.toFixed(1) + "GB";
var type = v.TYPE;
var drive = v.MP.split(/[/]/).pop().capitalise();
switch (type)
{
case 'vfat':
type = 'FAT';
case 'Unknown':
break;
default:
type = type.toUpperCase();
}
$('#usbejecttab').append(
'<tr><td><img class=va height=20 ' +
'src=/img/usb.png></td>' +
'<td class=usblabel>' + v.LABEL + '</td>' +
'<td class=blood>(' + drive + '&nbsp;-&nbsp;' +
type + '&nbsp;' + '&nbsp;-&nbsp;' +
size + ')</td>' +
'<td class="va pie" data-percent="' + v.USED +
'"></td>' +
'<td style="padding-left: 10px">' + v.USED +
'%' + '</td>' +
'<td><img class="va eject" border=0 height=20' +
' drive=' + v.MP +
' label="' + v.LABEL + '"' +
' src=/img/media-eject.png></td>' +
'</tr>');
$('#usbejecttab .pie').easyPieChart({
size: 20,
barColor: '#00ff00',
trackColor: '#A3A3C2',
lineWidth: 4,
scaleColor: false,
lineCap: 'butt'
});
});
$('#usbejectout').empty();
if (!num)
$('#usbejectout').html('No removable drives found.');
});
}).on('click', 'img.eject', function(e) {
e.stopPropagation();
var btn = $(this);
var drive = btn.attr('drive');
var label = btn.attr('label');
if (!confirm('Eject ' + label + '?'))
return;
$('#usbejectout').html('<img src=/img/loading.gif> ' +
'<span class=blood>Ejecting ' + label + '</span>');
$.getJSON('/cgi-bin/usbeject.jim', {
label: label,
drive: drive
}, function(data) {
$('#usbejectout').html(data.result);
if (data.status)
// Success
btn.closest('tr').slideUp('slow', function() {
$(this).remove();
});
});
});

View File

@@ -1,5 +1,8 @@
#!/mod/bin/jimsh
source /mod/webif/lib/setup
require system.class
puts {
<!doctype html>
<html>
@@ -24,6 +27,7 @@ puts {
<link href="/css/EXTRA.css" rel="Stylesheet" type="text/css" />
<script type="text/javascript" src="/js/jquery.js"></script>
<script type="text/javascript" src="/lib/jquery.ui/js/jquery-ui.js"></script>
<script type="text/javascript" src="/charts/high/highcharts.js"></script>
}
if {[info exists _mws_js]} {
foreach js $::_mws_js {
@@ -32,6 +36,7 @@ if {[info exists _mws_js]} {
foreach css $::_mws_css {
puts "<link href=\"$css\" rel=stylesheet type=text/css />"
}
incr ::_mws_headerdone
}
puts {
</head>

View File

@@ -0,0 +1,14 @@
/*! Copyright 2012, Ben Lin (http://dreamerslab.com/)
* Licensed under the MIT License (LICENSE.txt).
*
* Version: 1.0.16
*
* Requires: jQuery >= 1.2.3
*/
(function(a){a.fn.addBack=a.fn.addBack||a.fn.andSelf;
a.fn.extend({actual:function(b,l){if(!this[b]){throw'$.actual => The jQuery method "'+b+'" you called does not exist';}var f={absolute:false,clone:false,includeMargin:false};
var i=a.extend(f,l);var e=this.eq(0);var h,j;if(i.clone===true){h=function(){var m="position: absolute !important; top: -1000 !important; ";e=e.clone().attr("style",m).appendTo("body");
};j=function(){e.remove();};}else{var g=[];var d="";var c;h=function(){c=e.parents().addBack().filter(":hidden");d+="visibility: hidden !important; display: block !important; ";
if(i.absolute===true){d+="position: absolute !important; ";}c.each(function(){var m=a(this);var n=m.attr("style");g.push(n);m.attr("style",n?n+";"+d:d);
});};j=function(){c.each(function(m){var o=a(this);var n=g[m];if(n===undefined){o.removeAttr("style");}else{o.attr("style",n);}});};}h();var k=/(outer)/.test(b)?e[b](i.includeMargin):e[b]();
j();return k;}});})(jQuery);

View File

@@ -0,0 +1,56 @@
/*
bindWithDelay jQuery plugin
Author: Brian Grinstead
MIT license: http://www.opensource.org/licenses/mit-license.php
http://github.com/bgrins/bindWithDelay
http://briangrinstead.com/files/bindWithDelay
Usage:
See http://api.jquery.com/bind/
.bindWithDelay( eventType, [ eventData ], handler(eventObject), timeout, throttle )
Examples:
$("#foo").bindWithDelay("click", function(e) { }, 100);
$(window).bindWithDelay("resize", { optional: "eventData" }, callback, 1000);
$(window).bindWithDelay("resize", callback, 1000, true);
*/
(function($) {
$.fn.bindWithDelay = function( type, data, fn, timeout, throttle ) {
if ( $.isFunction( data ) ) {
throttle = timeout;
timeout = fn;
fn = data;
data = undefined;
}
// Allow delayed function to be removed with fn in unbind function
fn.guid = fn.guid || ($.guid && $.guid++);
// Bind each separately so that each element has its own delay
return this.each(function() {
var wait = null;
function cb() {
var e = $.extend(true, { }, arguments[0]);
var ctx = this;
var throttler = function() {
wait = null;
fn.apply(ctx, [e]);
};
if (!throttle) { clearTimeout(wait); wait = null; }
if (!wait) { wait = setTimeout(throttler, timeout); }
}
cb.guid = fn.guid;
$(this).bind(type, data, cb);
});
};
})(jQuery);

View File

@@ -18,4 +18,9 @@
.context-menu-item.icon-mp3 { background-image: url(/img/context/mp3.png); }
.context-menu-item.icon-clock { background-image: url(/img/context/clock.png); }
.context-menu-item.icon-thm { background-image: url(/img/context/thumb.png); }
.context-menu-item.icon-bookmark { background-image: url(/img/context/bookmark.png); }
.context-menu-item.icon-lock { background-image: url(/img/context/lock.png); }
.context-menu-item.icon-download { background-image: url(/img/context/download.png); }
.context-menu-item.icon-rename { background-image: url(/img/context/rename.png); }
.context-menu-item.icon-new { background-image: url(/img/context/new.png); }

View File

@@ -73,5 +73,10 @@
.contextMenu LI.mp3 A { background-image: url(/img/context/mp3.png); }
.contextMenu LI.clock A { background-image: url(/img/context/clock.png); }
.contextMenu LI.thm A { background-image: url(/img/context/thumb.png); }
.contextMenu LI.bookmark A { background-image: url(/img/context/bookmark.png); }
.contextMenu LI.lock A { background-image: url(/img/context/lock.png); }
.contextMenu LI.rename A { background-image: url(/img/context/rename.png); }
.contextMenu LI.download A { background-image: url(/img/context/download.png); }
.contextMenu LI.new A { background-image: url(/img/context/new.png); }

View File

@@ -7,7 +7,8 @@
.removeClass('ui-state-disabled')
.removeClass('ui-button-disabled')
.prop('disabled', false)
.removeAttr('aria-disabled');
.removeAttr('aria-disabled')
.disabled = false;
});
};
@@ -16,7 +17,8 @@
return this.each(function() {
$(this)
.addClass('ui-state-disabled')
.prop('disabled', true);
.prop('disabled', true)
.disabled = true;
});
};
})(jQuery);

View File

Before

Width:  |  Height:  |  Size: 2.5 KiB

After

Width:  |  Height:  |  Size: 2.5 KiB

View File

Before

Width:  |  Height:  |  Size: 2.4 KiB

After

Width:  |  Height:  |  Size: 2.4 KiB

View File

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

View File

@@ -0,0 +1 @@
ios-style-checkboxes

View File

@@ -1,4 +1,5 @@
.iPhoneCheckContainer {
-webkit-transform:translate3d(0,0,0);
position: relative;
height: 27px;
cursor: pointer;
@@ -7,16 +8,14 @@
position: absolute;
top: 5px;
left: 30px;
opacity: 0;
-ms-filter: progid:DXImageTransform.Microsoft.Alpha(Opacity=0);
filter: progid:DXImageTransform.Microsoft.Alpha(Opacity=0); }
filter: progid:DXImageTransform.Microsoft.Alpha(Opacity=0);
opacity: 0; }
.iPhoneCheckContainer label {
white-space: nowrap;
font-size: 17px;
line-height: 17px;
font-weight: bold;
font-family: "Helvetica Neue", Arial, Helvetica, sans-serif;
text-transform: uppercase;
cursor: pointer;
display: block;
height: 27px;
@@ -31,13 +30,12 @@
-khtml-user-select: none; }
.iPhoneCheckDisabled {
opacity: 0.5;
-ms-filter: progid:DXImageTransform.Microsoft.Alpha(Opacity=50);
filter: progid:DXImageTransform.Microsoft.Alpha(Opacity=50); }
filter: progid:DXImageTransform.Microsoft.Alpha(Opacity=50);
opacity: 0.5; }
label.iPhoneCheckLabelOn {
color: white;
background: url('/img/iphone-style-checkboxes/on.png?1282083753') no-repeat;
background: url('images/iphone-style-checkboxes/on.png?1284697268') no-repeat;
text-shadow: 0px 0px 2px rgba(0, 0, 0, 0.6);
left: 0;
padding-top: 5px; }
@@ -45,7 +43,7 @@ label.iPhoneCheckLabelOn {
padding-left: 8px; }
label.iPhoneCheckLabelOff {
color: #8b8b8b;
background: url('/img/iphone-style-checkboxes/off.png?1282083753') no-repeat right 0;
background: url('images/iphone-style-checkboxes/off.png?1284697268') no-repeat right 0;
text-shadow: 0px 0px 2px rgba(255, 255, 255, 0.6);
text-align: right;
right: 0; }
@@ -60,16 +58,89 @@ label.iPhoneCheckLabelOff {
top: 0;
left: 0;
width: 0;
background: url('/img/iphone-style-checkboxes/slider_left.png?1282083753') no-repeat;
background: url('images/iphone-style-checkboxes/slider_left.png?1284697268') no-repeat;
padding-left: 3px; }
.iPhoneCheckHandleRight {
height: 100%;
width: 100%;
padding-right: 3px;
background: url('/img/iphone-style-checkboxes/slider_right.png?1282083753') no-repeat right 0; }
background: url('images/iphone-style-checkboxes/slider_right.png?1284697268') no-repeat right 0; }
.iPhoneCheckHandleCenter {
height: 100%;
width: 100%;
background: url('/img/iphone-style-checkboxes/slider_center.png?1282083753'); }
background: url('images/iphone-style-checkboxes/slider_center.png?1284697268'); }
.iOSCheckContainer {
position: relative;
height: 27px;
cursor: pointer;
overflow: hidden; }
.iOSCheckContainer input {
position: absolute;
top: 5px;
left: 30px;
filter: progid:DXImageTransform.Microsoft.Alpha(Opacity=0);
opacity: 0; }
.iOSCheckContainer label {
white-space: nowrap;
font-size: 17px;
line-height: 17px;
font-weight: bold;
font-family: "Helvetica Neue", Arial, Helvetica, sans-serif;
cursor: pointer;
display: block;
height: 27px;
position: absolute;
width: auto;
top: 0;
padding-top: 5px;
overflow: hidden; }
.iOSCheckContainer, .iOSCheckContainer label {
user-select: none;
-moz-user-select: none;
-khtml-user-select: none; }
.iOSCheckDisabled {
filter: progid:DXImageTransform.Microsoft.Alpha(Opacity=50);
opacity: 0.5; }
label.iOSCheckLabelOn {
color: white;
background: url('images/ios-style-checkboxes/on.png?1284697268') no-repeat;
text-shadow: 0px 0px 2px rgba(0, 0, 0, 0.6);
left: 0;
padding-top: 5px; }
label.iOSCheckLabelOn span {
padding-left: 8px; }
label.iOSCheckLabelOff {
color: #8b8b8b;
background: url('images/ios-style-checkboxes/off.png?1284697268') no-repeat right 0;
text-shadow: 0px 0px 2px rgba(255, 255, 255, 0.6);
text-align: right;
right: 0; }
label.iOSCheckLabelOff span {
padding-right: 8px; }
.iOSCheckHandle {
display: block;
height: 27px;
cursor: pointer;
position: absolute;
top: 0;
left: 0;
width: 0;
background: url('images/ios-style-checkboxes/slider_left.png?1284697268') no-repeat;
padding-left: 3px; }
.iOSCheckHandleRight {
height: 100%;
width: 100%;
padding-right: 3px;
background: url('images/ios-style-checkboxes/slider_right.png?1284697268') no-repeat right 0; }
.iOSCheckHandleCenter {
height: 100%;
width: 100%;
background: url('images/ios-style-checkboxes/slider_center.png?1284697268'); }

View File

@@ -4,6 +4,13 @@
*/
;(function($, iphoneStyle) {
$.fn._width = function()
{
if ($.fn.actual != null)
return $(this).actual('width');
return $(this).width();
};
// Constructor
$[iphoneStyle] = function(elem, options) {
this.$elem = $(elem);
@@ -61,12 +68,12 @@ $.extend($[iphoneStyle].prototype, {
// Automatically resize the handle or container
optionallyResize: function(mode) {
var onLabelWidth = this.onLabel.width(),
offLabelWidth = this.offLabel.width();
var onLabelWidth = this.onLabel._width();
offLabelWidth = this.offLabel._width();
if (mode == 'container') {
var newWidth = (onLabelWidth > offLabelWidth) ? onLabelWidth : offLabelWidth;
newWidth += this.handle.width() + 15;
newWidth += this.handle._width() + 15;
} else {
var newWidth = (onLabelWidth < offLabelWidth) ? onLabelWidth : offLabelWidth;
}
@@ -146,11 +153,11 @@ $.extend($[iphoneStyle].prototype, {
// Setup the control's inital position
initialPosition: function() {
this.offLabel.css({ width: this.container.width() - 5 });
this.offLabel.css({ width: this.container._width() - 5 });
// var offset = ($.browser.msie && $.browser.version < 7) ? 3 : 6;
var offset = 6;
this.rightSide = this.container.width() - this.handle.width() - offset;
this.rightSide = this.container._width() - this.handle._width() - offset;
if (this.$elem.is(':checked')) {
this.handle.css({ left: this.rightSide });

View File

@@ -0,0 +1,65 @@
/**
* jQuery.fn.sortElements
* --------------
* @param Function comparator:
* Exactly the same behaviour as [1,2,3].sort(comparator)
*
* @param Function getSortable
* A function that should return the element that is
* to be sorted. The comparator will run on the
* current collection, but you may want the actual
* resulting sort to occur on a parent or another
* associated element.
*
* E.g. $('td').sortElements(comparator, function(){
* return this.parentNode;
* })
*
* The <td>'s parent (<tr>) will be sorted instead
* of the <td> itself.
*/
jQuery.fn.sortElements = (function(){
var sort = [].sort;
return function(comparator, getSortable) {
getSortable = getSortable || function(){return this;};
var placements = this.map(function(){
var sortElement = getSortable.call(this),
parentNode = sortElement.parentNode,
// Since the element itself will change position, we have
// to have some way of storing its original position in
// the DOM. The easiest way is to have a 'flag' node:
nextSibling = parentNode.insertBefore(
document.createTextNode(''),
sortElement.nextSibling
);
return function() {
if (parentNode === this) {
throw new Error(
"You can't sort elements if any one is a descendant of another."
);
}
// Insert before flag:
parentNode.insertBefore(this, nextSibling);
// Remove flag:
parentNode.removeChild(nextSibling);
};
});
return sort.call(this, comparator).each(function(i){
placements[i].call(getSortable.call(this));
});
};
})();

Binary file not shown.

After

Width:  |  Height:  |  Size: 48 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 49 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 54 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 284 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 223 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 275 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 278 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 273 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 277 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 283 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 283 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 513 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 520 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 285 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 285 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 180 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 213 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 232 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 673 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 181 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 209 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 224 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 720 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 737 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 416 B

Some files were not shown because too many files have changed in this diff Show More