diff options
Diffstat (limited to 'mediagoblin/static/js')
-rw-r--r-- | mediagoblin/static/js/audio.js | 6 | ||||
-rw-r--r-- | mediagoblin/static/js/autofilledin_password.js | 25 | ||||
l--------- | mediagoblin/static/js/extlib/video-js | 1 | ||||
-rw-r--r-- | mediagoblin/static/js/geolocation-map.js | 5 | ||||
-rw-r--r-- | mediagoblin/static/js/keyboard_navigation.js | 41 | ||||
-rw-r--r-- | mediagoblin/static/js/show_password.js | 1 |
6 files changed, 79 insertions, 0 deletions
diff --git a/mediagoblin/static/js/audio.js b/mediagoblin/static/js/audio.js index 8c91bd0b..91d52f96 100644 --- a/mediagoblin/static/js/audio.js +++ b/mediagoblin/static/js/audio.js @@ -133,6 +133,12 @@ var audioPlayer = new Object(); })(audioPlayer); $(document).ready(function () { + if (!$('.audio-media').length) { + return; + } + + console.log('Initializing audio player'); + audioElements = $('.audio-media .audio-player'); audioPlayer.init(audioElements[0]); audioPlayer.attachToImage($('.audio-spectrogram img')[0]); diff --git a/mediagoblin/static/js/autofilledin_password.js b/mediagoblin/static/js/autofilledin_password.js new file mode 100644 index 00000000..45e867fe --- /dev/null +++ b/mediagoblin/static/js/autofilledin_password.js @@ -0,0 +1,25 @@ +/** + * GNU MediaGoblin -- federated, autonomous media hosting + * Copyright (C) 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(){ + $('#forgot_password').click(function(event){ + event.preventDefault(); + window.location.pathname = $(this).attr('href') + '?username=' + + $('#username').val(); + }); +}); diff --git a/mediagoblin/static/js/extlib/video-js b/mediagoblin/static/js/extlib/video-js new file mode 120000 index 00000000..35da21ca --- /dev/null +++ b/mediagoblin/static/js/extlib/video-js @@ -0,0 +1 @@ +../../../../extlib/video-js
\ No newline at end of file diff --git a/mediagoblin/static/js/geolocation-map.js b/mediagoblin/static/js/geolocation-map.js index a2c62045..de49a37d 100644 --- a/mediagoblin/static/js/geolocation-map.js +++ b/mediagoblin/static/js/geolocation-map.js @@ -17,6 +17,11 @@ */ $(document).ready(function () { + if (!$('#tile-map').length) { + return; + } + console.log('Initializing map'); + var longitude = Number( $('#tile-map #gps-longitude').val()); var latitude = Number( diff --git a/mediagoblin/static/js/keyboard_navigation.js b/mediagoblin/static/js/keyboard_navigation.js new file mode 100644 index 00000000..7401e4d8 --- /dev/null +++ b/mediagoblin/static/js/keyboard_navigation.js @@ -0,0 +1,41 @@ +/** + * 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/>. + */ + +/* It must be wrapped into a function and you also cannot use + * $(':not(textarea, input)') because of some reason. */ + +$(document).ready(function(){ + $('textarea, input').keydown(function(event){ + event.stopPropagation(); + }); +}); + +$(document).keydown(function(event){ + switch(event.which){ + case 37: + if($('a.navigation_left').length) { + window.location = $('a.navigation_left').attr('href'); + } + break; + case 39: + if($('a.navigation_right').length) { + window.location = $('a.navigation_right').attr('href'); + } + break; + } +}); diff --git a/mediagoblin/static/js/show_password.js b/mediagoblin/static/js/show_password.js index e42d44ea..b3fbc862 100644 --- a/mediagoblin/static/js/show_password.js +++ b/mediagoblin/static/js/show_password.js @@ -17,6 +17,7 @@ */ $(document).ready(function(){ + //Create a duplicate password field. We could change the input type dynamically, but this angers the IE gods (not just IE6). $("#password").after('<input type="text" value="" name="password_clear" id="password_clear" /><label><input type="checkbox" id="password_boolean" />Show password</label>'); $('#password_clear').hide(); $('#password_boolean').click(function(){ |