aboutsummaryrefslogtreecommitdiffstats
path: root/mediagoblin/static/js
diff options
context:
space:
mode:
Diffstat (limited to 'mediagoblin/static/js')
l---------mediagoblin/static/js/extlib/html5slider.js1
l---------mediagoblin/static/js/extlib/jquery.js2
-rw-r--r--mediagoblin/static/js/geolocation-map.js6
-rw-r--r--mediagoblin/static/js/header_dropdown.js24
-rw-r--r--mediagoblin/static/js/post_comment.js63
5 files changed, 87 insertions, 9 deletions
diff --git a/mediagoblin/static/js/extlib/html5slider.js b/mediagoblin/static/js/extlib/html5slider.js
deleted file mode 120000
index feae2cb8..00000000
--- a/mediagoblin/static/js/extlib/html5slider.js
+++ /dev/null
@@ -1 +0,0 @@
-../../../../extlib/html5slider/html5slider.js \ No newline at end of file
diff --git a/mediagoblin/static/js/extlib/jquery.js b/mediagoblin/static/js/extlib/jquery.js
index d78f5cc3..8c711f27 120000
--- a/mediagoblin/static/js/extlib/jquery.js
+++ b/mediagoblin/static/js/extlib/jquery.js
@@ -1 +1 @@
-../../../../extlib/jquery/jquery.js \ No newline at end of file
+../../../../extlib/jquery/dist/jquery.js \ No newline at end of file
diff --git a/mediagoblin/static/js/geolocation-map.js b/mediagoblin/static/js/geolocation-map.js
index 26d94c5d..c30788f7 100644
--- a/mediagoblin/static/js/geolocation-map.js
+++ b/mediagoblin/static/js/geolocation-map.js
@@ -30,13 +30,11 @@ $(document).ready(function () {
// Get a new map instance attached and element with id="tile-map"
var map = new L.Map('tile-map');
- var mqtileUrl = 'http://otile{s}.mqcdn.com/tiles/1.0.0/osm/{z}/{x}/{y}.jpg';
+ var mqtileUrl = 'https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png';
var mqtileAttrib = '<a id="osm_license_link">see map license</a>';
var mqtile = new L.TileLayer(
mqtileUrl,
- {maxZoom: 18,
- attribution: mqtileAttrib,
- subdomains: '1234'});
+ {maxZoom: 18});
map.attributionControl.setPrefix('');
var location = new L.LatLng(latitude, longitude);
diff --git a/mediagoblin/static/js/header_dropdown.js b/mediagoblin/static/js/header_dropdown.js
index 3ee46228..979d2690 100644
--- a/mediagoblin/static/js/header_dropdown.js
+++ b/mediagoblin/static/js/header_dropdown.js
@@ -17,9 +17,27 @@
*/
$(document).ready(function(){
- $("#header_dropdown").hide();
- $(".header_dropdown_up").hide();
- $(".header_dropdown_down,.header_dropdown_up").click(function() {
+ // The header drop-down header panel defaults to open until you explicitly
+ // close it. After that, the panel open/closed setting will persist across
+ // page loads.
+
+ // Initialise the panel status when page is loaded.
+ if (localStorage.getItem("panel_closed")) {
+ $("#header_dropdown").hide();
+ $(".header_dropdown_up").hide();
+ }
+ else {
+ $(".header_dropdown_down").hide();
+ }
+
+ // Toggle and persist the panel status.
+ $(".header_dropdown_down, .header_dropdown_up").click(function() {
+ if (localStorage.getItem("panel_closed")) {
+ localStorage.removeItem("panel_closed");
+ }
+ else {
+ localStorage.setItem("panel_closed", "true");
+ }
$(".header_dropdown_down").toggle();
$(".header_dropdown_up").toggle();
$("#header_dropdown").slideToggle();
diff --git a/mediagoblin/static/js/post_comment.js b/mediagoblin/static/js/post_comment.js
new file mode 100644
index 00000000..431c222f
--- /dev/null
+++ b/mediagoblin/static/js/post_comment.js
@@ -0,0 +1,63 @@
+/**
+ * GNU MediaGoblin -- federated, autonomous media hosting
+ * Copyright (C) 2011, 2012 MediaGoblin contributors. See AUTHORS.
+ *
+ * This program 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.
+ *
+ * This program 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 this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+$(document).ready(function(){
+ $(function() {
+ // Hide this button if script is enabled
+ $('.form_submit_buttons').find('input').hide();
+
+ // Include this link if script is enabled
+ $('.form_submit_buttons').append(
+ '<a class="button_action" id="post_comment" type="button">' +
+ 'Add this comment </a>');
+
+ $('#post_comment').click(function() {
+ $.ajax({
+ url: $('#postCommentURL').val(),
+ data: $('#form_comment').serialize(),
+ type: 'POST',
+ success: function(response) {
+ var message = $(response).find('.mediagoblin_messages');
+ var commentsInResponse = $($(response).find('.media_comments')).find('li');
+ var commentsInPage = $('.media_comments').find('ul');
+
+ // Post the message
+ message.css({"position":"fixed", "top":"50px", "width":"100%"});
+ $('body').append(message);
+ message.delay(1500).fadeOut();
+
+ // Checking if there is new comment
+ if(commentsInResponse.length != $(commentsInPage).find('li').length) {
+ // Post comment and scroll down to it
+ var newComment = commentsInResponse[commentsInResponse.length - 1];
+ $('#form_comment').fadeOut('fast');
+ $('#button_addcomment').fadeIn('fast');
+ $('#comment_preview').replaceWith("<div id=comment_preview></div>");
+ $(commentsInPage).append(newComment);
+ $('html, body').animate({
+ scrollTop: $(newComment).offset().top
+ }, 1000);
+ }
+ },
+ error: function(error) {
+ console.log(error);
+ }
+ });
+ });
+ });
+}); \ No newline at end of file