From 0205c3f02124d62c980ba0656babd544f2cb7d19 Mon Sep 17 00:00:00 2001 From: paul Date: Wed, 13 Apr 2016 13:21:16 +0000 Subject: [PATCH] separate quicklinks page svn path=/trunk/; revision=118 --- pages/list.sh | 13 -------- pages/quicklinks.sh | 58 ++++++++++++++++++++++++++++++++++++ static/common.css | 15 +++++----- templates/advfilter.html.sh | 5 +--- templates/quicklinks.html.sh | 51 +++++++++++++++++++++++++++++++ 5 files changed, 117 insertions(+), 25 deletions(-) create mode 100755 pages/quicklinks.sh create mode 100755 templates/quicklinks.html.sh diff --git a/pages/list.sh b/pages/list.sh index fc4ff66..2c4b1f1 100755 --- a/pages/list.sh +++ b/pages/list.sh @@ -39,19 +39,6 @@ else TITLE="List by $order" fi -quicklinks(){ - output='' - tac ${_DATA}/meta/recent \ - | while [ "$(printf %s "$output" |wc -l)" -lt 30 ] && read line; do - printf %s "$output" |grep -qF "$line" || output="$output$line$LF" - done - printf %s "$output" |while read line; do - linef=$(printf %s "$line" |sed -r 's;^.*(\?|&)f=([^&]+)&?.*$;\2;g') - lineo=$(printf %s "$line" |sed -r 's;^.*(\?|&)o=([^&]+)&?.*$;\2;g') - printf 'by %s: %s' "$line" "${lineo}" "$(present_filter "$linef")" - done -} - category_selected(){ cat="${1}:" filter="$2" diff --git a/pages/quicklinks.sh b/pages/quicklinks.sh new file mode 100755 index 0000000..2172919 --- /dev/null +++ b/pages/quicklinks.sh @@ -0,0 +1,58 @@ +#!/bin/zsh + +# Copyright 2014 - 2016 Paul Hänsch +# +# This file is part of Serve0. +# +# Serve0 is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# Serve0 is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with Serve0. If not, see . + +. $_EXEC/pages/common.sh + +LF=' +' +filters="${_GET[f]}" +debug "FILTERS: $filters" + +present_filter(){ + printf %s\\n "$*" \ + | sed -r 's;(^|!|\^|\|)([^!\^\|:]+:);\1;g;s;\^;\n;g' \ + | sort -r \ + | sed -r '$q;s;$; \&\; ;g' +} + +quicklinks(){ + output='' + tac ${_DATA}/meta/recent \ + | while [ "$(printf %s "$output" |wc -l)" -lt 30 ] && read line; do + printf %s "$output" |grep -qF "$line" || output="$output$line$LF" + done + printf %s "$output" |while read line; do + linef=$(printf %s "$line" |sed -r 's;^.*(\?|&)f=([^&]+)&?.*$;\2;g') + lineo=$(printf %s "$line" |sed -r 's;^.*(\?|&)o=([^&]+)&?.*$;\2;g') + printf 'by %s: %s' \ + "$line" "${lineo}" "$(present_filter "$linef")" + done +} + +category_selected(){ + cat="${1}:" + filter="$2" + [ "$cat" = "none:" ] && cat='' + + printf %s "$taglist" \ + | sed -r 's;^('"$filter"')$;1 &;;t;s;^;0 ;' \ + | sed -rn 's;^(0|1) '"$cat"'([^:]+)$;\1 \2;p' \ + | sed 's;^0 ;;' +} + diff --git a/static/common.css b/static/common.css index 96f15be..370be05 100644 --- a/static/common.css +++ b/static/common.css @@ -248,19 +248,18 @@ div.panel { } #advfilter .quicklinks {width: 100%;} -#advfilter .quicklinks :first-child {width: 100%;} -#advfilter .quicklinks input { display: none; } -#advfilter .quicklinks a { - display: none; + +.quicklinks :first-child {width: 100%;} +.quicklinks input { display: block; } +.quicklinks a { + display: block; word-wrap: break-word; margin-left: 10%; margin-bottom: .75em; margin-top: -1.5em; } -#advfilter .quicklinks:hover input, -#advfilter .quicklinks:hover a {display: block;} -#advfilter .quicklinks input:checked, -#advfilter .quicklinks input:checked + a { display: none;} +.quicklinks input:checked, +.quicklinks input:checked + a { display: none;} /* == Thumblist == */ diff --git a/templates/advfilter.html.sh b/templates/advfilter.html.sh index 7fac882..c4f14cc 100755 --- a/templates/advfilter.html.sh +++ b/templates/advfilter.html.sh @@ -75,10 +75,7 @@ cat <

- + Most recent EOF diff --git a/templates/quicklinks.html.sh b/templates/quicklinks.html.sh new file mode 100755 index 0000000..345049b --- /dev/null +++ b/templates/quicklinks.html.sh @@ -0,0 +1,51 @@ +# Copyright 2014 - 2016 Paul Hänsch +# +# This file is part of Serve0 +# +# Serve0 is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# Serve0 is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with Serve0 If not, see . + +cat < + + + + + + Clear All + Advanced + Player + + + $(. $_EXEC/templates/playpanel.html.sh) + + + + + + $(. $_EXEC/templates/preferences.html.sh) + $(. $_EXEC/templates/advfilter.html.sh) +EOF + +# vi:set filetype=html: -- 2.39.2