From fb2b66e2dd67ceefc94d8e64eedd9300f64d695f Mon Sep 17 00:00:00 2001
From: sinuca <55vitaminado@gmail.com>
Date: Mon, 17 Mar 2014 19:11:16 -0300
Subject: Recent posts functionality
Conflicts:
inc/config.php
inc/mod/pages.php
mod.php
---
js/recent-posts.js | 73 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 73 insertions(+)
create mode 100644 js/recent-posts.js
(limited to 'js')
diff --git a/js/recent-posts.js b/js/recent-posts.js
new file mode 100644
index 00000000..c65f6991
--- /dev/null
+++ b/js/recent-posts.js
@@ -0,0 +1,73 @@
+/*
+ * recent-posts.js
+ *
+ * Recent posts controlling script
+ *
+ * Released under the WTFPL license
+ * Copyright (c) 2014 sinuca <#55ch@rizon.net>
+ *
+ * Requires jquery
+ * incomplete
+ *
+ */
+
+$(document).ready(function(){
+
+ if (!localStorage.hiddenrecentposts)
+ localStorage.hiddenrecentposts = '{}';
+
+ if (!localStorage.recentpostscount)
+ localStorage.recentpostscount = 25;
+
+ // Load data from HTML5 localStorage
+ var hidden_data = JSON.parse(localStorage.hiddenrecentposts);
+
+ var store_data_posts = function() {
+ localStorage.hiddenrecentposts = JSON.stringify(hidden_data);
+ }
+
+ // Delete old hidden posts (7+ days old)
+ for (var key in hidden_data) {
+ for (var id in hidden_data[key]) {
+ if (hidden_data[key][id] < Math.round(Date.now() / 1000) - 60 * 60 * 24 * 7) {
+ delete hidden_data[key][id];
+ store_data_posts();
+ }
+ }
+ }
+
+ var do_hide_posts = function() {
+ var data = $(this).attr('id');
+ var splitted = data.split('-');
+ var id = splitted[2];
+ var post_container = $(this).parent();
+
+ var board = post_container.data("board");
+
+ if (!hidden_data[board]) {
+ hidden_data[board] = {};
+ }
+
+ $(' Dismiss ')
+ .insertBefore(post_container.find('a.eita-link:first'))
+ .click(function(){
+ hidden_data[board][id] = Math.round(Date.now() / 1000);
+ store_data_posts();
+
+ post_container.closest('hr').hide();
+ post_container.children().hide();
+ });
+ if(hidden_data[board][id])
+ post_container.find('a.hide-post-link').click();
+ }
+
+ $('a.eita-link').each(do_hide_posts);
+
+ $('#erase-local-data').click(function(){
+ hidden_data = {};
+ store_data_posts();
+ $(this).html('Loading...');
+ location.reload();
+ });
+
+});
\ No newline at end of file
--
cgit v1.3
From e0a89c597d3de8867d0faa01244fe8d5d06c34cc Mon Sep 17 00:00:00 2001
From: czaks
Date: Tue, 25 Mar 2014 11:37:39 +0100
Subject: move recent-posts to mod
---
js/mod/recent-posts.js | 73 ++++++++++++++++++++++++++++++++++++++++++++++++++
js/recent-posts.js | 73 --------------------------------------------------
2 files changed, 73 insertions(+), 73 deletions(-)
create mode 100644 js/mod/recent-posts.js
delete mode 100644 js/recent-posts.js
(limited to 'js')
diff --git a/js/mod/recent-posts.js b/js/mod/recent-posts.js
new file mode 100644
index 00000000..c65f6991
--- /dev/null
+++ b/js/mod/recent-posts.js
@@ -0,0 +1,73 @@
+/*
+ * recent-posts.js
+ *
+ * Recent posts controlling script
+ *
+ * Released under the WTFPL license
+ * Copyright (c) 2014 sinuca <#55ch@rizon.net>
+ *
+ * Requires jquery
+ * incomplete
+ *
+ */
+
+$(document).ready(function(){
+
+ if (!localStorage.hiddenrecentposts)
+ localStorage.hiddenrecentposts = '{}';
+
+ if (!localStorage.recentpostscount)
+ localStorage.recentpostscount = 25;
+
+ // Load data from HTML5 localStorage
+ var hidden_data = JSON.parse(localStorage.hiddenrecentposts);
+
+ var store_data_posts = function() {
+ localStorage.hiddenrecentposts = JSON.stringify(hidden_data);
+ }
+
+ // Delete old hidden posts (7+ days old)
+ for (var key in hidden_data) {
+ for (var id in hidden_data[key]) {
+ if (hidden_data[key][id] < Math.round(Date.now() / 1000) - 60 * 60 * 24 * 7) {
+ delete hidden_data[key][id];
+ store_data_posts();
+ }
+ }
+ }
+
+ var do_hide_posts = function() {
+ var data = $(this).attr('id');
+ var splitted = data.split('-');
+ var id = splitted[2];
+ var post_container = $(this).parent();
+
+ var board = post_container.data("board");
+
+ if (!hidden_data[board]) {
+ hidden_data[board] = {};
+ }
+
+ $(' Dismiss ')
+ .insertBefore(post_container.find('a.eita-link:first'))
+ .click(function(){
+ hidden_data[board][id] = Math.round(Date.now() / 1000);
+ store_data_posts();
+
+ post_container.closest('hr').hide();
+ post_container.children().hide();
+ });
+ if(hidden_data[board][id])
+ post_container.find('a.hide-post-link').click();
+ }
+
+ $('a.eita-link').each(do_hide_posts);
+
+ $('#erase-local-data').click(function(){
+ hidden_data = {};
+ store_data_posts();
+ $(this).html('Loading...');
+ location.reload();
+ });
+
+});
\ No newline at end of file
diff --git a/js/recent-posts.js b/js/recent-posts.js
deleted file mode 100644
index c65f6991..00000000
--- a/js/recent-posts.js
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * recent-posts.js
- *
- * Recent posts controlling script
- *
- * Released under the WTFPL license
- * Copyright (c) 2014 sinuca <#55ch@rizon.net>
- *
- * Requires jquery
- * incomplete
- *
- */
-
-$(document).ready(function(){
-
- if (!localStorage.hiddenrecentposts)
- localStorage.hiddenrecentposts = '{}';
-
- if (!localStorage.recentpostscount)
- localStorage.recentpostscount = 25;
-
- // Load data from HTML5 localStorage
- var hidden_data = JSON.parse(localStorage.hiddenrecentposts);
-
- var store_data_posts = function() {
- localStorage.hiddenrecentposts = JSON.stringify(hidden_data);
- }
-
- // Delete old hidden posts (7+ days old)
- for (var key in hidden_data) {
- for (var id in hidden_data[key]) {
- if (hidden_data[key][id] < Math.round(Date.now() / 1000) - 60 * 60 * 24 * 7) {
- delete hidden_data[key][id];
- store_data_posts();
- }
- }
- }
-
- var do_hide_posts = function() {
- var data = $(this).attr('id');
- var splitted = data.split('-');
- var id = splitted[2];
- var post_container = $(this).parent();
-
- var board = post_container.data("board");
-
- if (!hidden_data[board]) {
- hidden_data[board] = {};
- }
-
- $(' Dismiss ')
- .insertBefore(post_container.find('a.eita-link:first'))
- .click(function(){
- hidden_data[board][id] = Math.round(Date.now() / 1000);
- store_data_posts();
-
- post_container.closest('hr').hide();
- post_container.children().hide();
- });
- if(hidden_data[board][id])
- post_container.find('a.hide-post-link').click();
- }
-
- $('a.eita-link').each(do_hide_posts);
-
- $('#erase-local-data').click(function(){
- hidden_data = {};
- store_data_posts();
- $(this).html('Loading...');
- location.reload();
- });
-
-});
\ No newline at end of file
--
cgit v1.3
From b0c837ce9369b932cecff91966dacdaef4a96952 Mon Sep 17 00:00:00 2001
From: sinuca <55vitaminado@gmail.com>
Date: Tue, 25 Mar 2014 11:41:20 +0100
Subject: expand-images.js: shrink all images functionality
---
js/expand-all-images.js | 13 ++++++++++++-
1 file changed, 12 insertions(+), 1 deletion(-)
(limited to 'js')
diff --git a/js/expand-all-images.js b/js/expand-all-images.js
index 6ef58ca9..fc273e5e 100644
--- a/js/expand-all-images.js
+++ b/js/expand-all-images.js
@@ -7,6 +7,7 @@
* Released under the MIT license
* Copyright (c) 2012-2013 Michael Save
* Copyright (c) 2013-2014 Marcin Ćabanowski
+ * Copyright (c) 2014 sinuca <#55ch@rizon.net>
*
* Usage:
* $config['additional_javascript'][] = 'js/jquery.min.js';
@@ -25,6 +26,16 @@ onready(function(){
if (!$(this).parent()[0].dataset.expanded)
$(this).parent().click();
});
- $(this).parent().remove();
+
+ $('hr:first').before('');
+ $('div#shrink-all-images a')
+ .text(_('Shrink all images'))
+ .click(function(){
+ $('a img.post-image').each(function() {
+ if ($(this).parent()[0].dataset.expanded)
+ $(this).parent().click();
+ });
+ $(this).parent().remove();
+ });
});
});
--
cgit v1.3