diff options
| -rw-r--r-- | scripts/fix_fav_counts.py | 24 | ||||
| -rwxr-xr-x | scripts/sort_faves.sh | 4 | ||||
| -rw-r--r-- | src/site.clj | 8 | ||||
| -rwxr-xr-x | static/css/dump.css | 1 | ||||
| -rw-r--r-- | static/js/pichat.js | 1 | ||||
| -rwxr-xr-x | static/js/register.js | 24 | ||||
| -rw-r--r-- | static/js/src/_main.js | 1 |
7 files changed, 51 insertions, 12 deletions
diff --git a/scripts/fix_fav_counts.py b/scripts/fix_fav_counts.py index 00e8d0f..0472488 100644 --- a/scripts/fix_fav_counts.py +++ b/scripts/fix_fav_counts.py @@ -3,13 +3,23 @@ before running this command, please run the following SQL, which tallies the faves per post: - COPY (SELECT messages.user_id, tags.message_id, COUNT(tags.message_id) AS mycount, TO_CHAR(messages.created_on, 'YYYYMMDD') + COPY (SELECT messages.user_id, tags.message_id, COUNT(tags.message_id) + AS mycount, TO_CHAR(messages.created_on, 'YYYYMMDD') FROM tags, messages WHERE tags.message_id = messages.message_id AND tags.tag = 'favorite' GROUP BY tags.message_id, messages.user_id, messages.created_on) - TO '/tmp/fav_counts2.csv' WITH CSV; + TO '/tmp/fav_counts69.csv' WITH CSV; - then run ./sort_faves.sh which will pre-sort the data for this script. + this file will be owned by the postgres user, + so change the 69 to some other number (janky i know) + + then run ./sort_faves.sh /tmp/fav_counts69.csv + ...which will pre-sort the data for this script. + + then run python3 fix_fav_counts.py + ...this script. + + if you run this twice, don't worry, data will not be duplicated. """ import re @@ -33,6 +43,7 @@ def fetch_users(): # field order: user_id, message_id, score, date def load_faves_by_user(): + print("fixing favscores...") nicks = load_nicks() counter = 0 user_counter = 0 @@ -59,6 +70,7 @@ def load_faves_by_user(): counter += 1 def load_faves_by_date(): + print("fixing daily halls...") date_counter = 0 counter = 0 date = "" @@ -79,6 +91,7 @@ def load_faves_by_date(): counter += 1 def load_hall(): + print("fixing hall...") with open('faves/hall.csv', 'r') as csvfile: reader = csv.reader(csvfile) for row in reader: @@ -93,7 +106,8 @@ def load_nicks(): return nicks if __name__ == "__main__": - # load_hall() - # load_faves_by_user() + load_hall() + load_faves_by_user() load_faves_by_date() + print("done!") diff --git a/scripts/sort_faves.sh b/scripts/sort_faves.sh index eb28a39..3daad0b 100755 --- a/scripts/sort_faves.sh +++ b/scripts/sort_faves.sh @@ -12,9 +12,9 @@ echo "Get the top 50 faves for the Hall of Fame" sort -t, -k3,3 -rn $1 | head -50 > faves/hall.csv echo "Group faves by user for popular pages, total fave scores" -sort -t, -k1,1 -r -k3,3 -n faves/counts_sorted.csv > faves/by_user.csv +sort -t, -k1,1 -r -k3,3 -n $1 > faves/by_user.csv echo "Group faves by date for daily tallies" -sort -t, -k4,4 -r -k3,3 -n faves/counts_sorted.csv > faves/by_date.csv +sort -t, -k4,4 -r -k3,3 -n $1 > faves/by_date.csv diff --git a/src/site.clj b/src/site.clj index 67bb007..afde8c5 100644 --- a/src/site.clj +++ b/src/site.clj @@ -227,10 +227,10 @@ (defn front-page ([session] - (cond - (not (:nick session)) (serve-meme session "fullscreen") - :else (redirect-to "/chat") ) ) - ; :else (front-page session (format-yyyymmdd (Date.))) )) + (cond + (not (:nick session)) (serve-meme session "fullscreen") + ; :else (redirect-to "/chat") ) ) + :else (front-page session (format-yyyymmdd (Date.))) )) ([session dt-str] (let [today (Date.)] (if-let [[prev-date cur-date next-date] (parse-front-page-date dt-str)] diff --git a/static/css/dump.css b/static/css/dump.css index acf9ea6..de64bbb 100755 --- a/static/css/dump.css +++ b/static/css/dump.css @@ -2515,6 +2515,7 @@ a#disregister:hover { .nick_aids_enoch a:link, .nick_aids_enoch .content, .nick_aids_enoch .msg-hover { color: transparent; text-shadow: 0 0 5px #857E96; } .nick_aids_enoch { opacity: 0.3; } +.nick_aids_enoch img { -webkit-filter: blur(4px); } .bigimage { max-width: none!important; max-height: none!important;width:100% } diff --git a/static/js/pichat.js b/static/js/pichat.js index 1003880..0ed479a 100644 --- a/static/js/pichat.js +++ b/static/js/pichat.js @@ -246,6 +246,7 @@ window.Preferences = { $.cookie(prop, null, { domain: Preferences.Domain, path: '/' }); } }; + window.Away = { "UnseenMsgCounter": 0, "OrigTitle": "", diff --git a/static/js/register.js b/static/js/register.js index d2d513d..4352c19 100755 --- a/static/js/register.js +++ b/static/js/register.js @@ -64,8 +64,30 @@ function submitRegistration() { }); } +function hasLocalStorage() { + try { + return 'localStorage' in window && window['localStorage'] !== null; + } catch (e) { + return false; + } +} + function initRegister() { - $('#submit').click(submitRegistration); + var date = new Date () + var open_reg = false || ! ('LoggedIn' in window) + if (hasLocalStorage() && localStorage.is_banned == "true") { + $('.regopen').remove() + $('.log-in').remove() + $('#forgetpw').remove() + return + } + if (open_reg || ( date.getHours() >= 8 && date.getHours() <= 17 )) { + $('.regclosed').remove() + $('#submit').click(submitRegistration); + } + else { + $('.regopen').remove() + } } // sha1.js diff --git a/static/js/src/_main.js b/static/js/src/_main.js index b2fe1a9..c95b98a 100644 --- a/static/js/src/_main.js +++ b/static/js/src/_main.js @@ -46,3 +46,4 @@ window.Preferences = { $.cookie(prop, null, { domain: Preferences.Domain, path: '/' }); } }; + |
