aboutsummaryrefslogtreecommitdiffstats
path: root/view
diff options
context:
space:
mode:
authorKlaus Weidenbach <Klaus.Weidenbach@gmx.net>2015-03-12 22:57:00 +0100
committerKlaus Weidenbach <Klaus.Weidenbach@gmx.net>2015-03-12 22:57:00 +0100
commitc6162c4c88da2a903f07dd114d23d75cc94e9478 (patch)
treeb5219ea7a4baca6b4d3525c031ac20d6fbdb25e5 /view
parentd11bec6f584574ae6045e0fe09b544d920e53f2a (diff)
downloadvolse-hubzilla-c6162c4c88da2a903f07dd114d23d75cc94e9478.tar.gz
volse-hubzilla-c6162c4c88da2a903f07dd114d23d75cc94e9478.tar.bz2
volse-hubzilla-c6162c4c88da2a903f07dd114d23d75cc94e9478.zip
Fix JavaScript problems on channels where you are not allowed to upload photos.
Add some try...catch blocks around JavaScript that throws errors. This commit should fix the current problems that were introduced by an earlier commit.
Diffstat (limited to 'view')
-rwxr-xr-xview/tpl/jot-header.tpl102
1 files changed, 46 insertions, 56 deletions
diff --git a/view/tpl/jot-header.tpl b/view/tpl/jot-header.tpl
index c7bb7506e..0ffed7163 100755
--- a/view/tpl/jot-header.tpl
+++ b/view/tpl/jot-header.tpl
@@ -1,6 +1,6 @@
<script language="javascript" type="text/javascript">
-var editor=false;
+var editor = false;
var textlen = 0;
var plaintext = '{{$editselect}}';
@@ -22,7 +22,7 @@ function initEditor(cb){
$(".jothidden").show();
if (typeof cb!="undefined") cb();
return;
- }
+ }
tinyMCE.init({
theme : "advanced",
mode : "specific_textareas",
@@ -74,8 +74,7 @@ function initEditor(cb){
}
else {
$('#profile-jot-desc').html('&nbsp;');
- }
-
+ }
});
ed.onInit.add(function(ed) {
@@ -89,7 +88,6 @@ function initEditor(cb){
});
editor = true;
-
} else {
if (typeof cb!="undefined") cb();
}
@@ -100,22 +98,19 @@ function enableOnUser(){
$(this).val("");
initEditor();
}
-
</script>
<script type="text/javascript" src="{{$baseurl}}/view/js/ajaxupload.js" ></script>
<script>
var ispublic = '{{$ispublic}}';
$(document).ready(function() {
-
/* enable tinymce on focus and click */
$("#profile-jot-text").focus(enableOnUser);
$("#profile-jot-text").click(enableOnUser);
var upload_title = $('#wall-image-upload').attr('title');
var attach_title = $('#wall-file-upload').attr('title');
-
- var uploader = new window.AjaxUpload(
- 'wall-image-upload',
+ try {
+ var uploader = new window.AjaxUpload('wall-image-upload',
{ action: '{{$baseurl}}/wall_upload/{{$nickname}}',
name: 'userfile',
title: upload_title,
@@ -124,11 +119,12 @@ function enableOnUser(){
addeditortext(response);
$('#jot-media').val($('#jot-media').val() + response);
$('#profile-rotator').spin(false);
- }
- }
- );
- var uploader_sub = new window.AjaxUpload(
- 'wall-image-upload-sub',
+ }
+ });
+ } catch (e) {
+ }
+ try {
+ var uploader_sub = new window.AjaxUpload('wall-image-upload-sub',
{ action: '{{$baseurl}}/wall_upload/{{$nickname}}',
name: 'userfile',
title: upload_title,
@@ -137,12 +133,12 @@ function enableOnUser(){
addeditortext(response);
$('#jot-media').val($('#jot-media').val() + response);
$('#profile-rotator').spin(false);
- }
- }
- );
-
- var file_uploader = new window.AjaxUpload(
- 'wall-file-upload',
+ }
+ });
+ } catch(e) {
+ }
+ try {
+ var file_uploader = new window.AjaxUpload('wall-file-upload',
{ action: '{{$baseurl}}/wall_attach/{{$nickname}}',
name: 'userfile',
title: attach_title,
@@ -152,10 +148,11 @@ function enableOnUser(){
$('#jot-media').val($('#jot-media').val() + response);
$('#profile-rotator').spin(false);
}
- }
- );
- var file_uploader_sub = new window.AjaxUpload(
- 'wall-file-upload-sub',
+ });
+ } catch(e) {
+ }
+ try {
+ var file_uploader_sub = new window.AjaxUpload('wall-file-upload-sub',
{ action: '{{$baseurl}}/wall_attach/{{$nickname}}',
name: 'userfile',
title: attach_title,
@@ -165,10 +162,9 @@ function enableOnUser(){
$('#jot-media').val($('#jot-media').val() + response);
$('#profile-rotator').spin(false);
}
- }
- );
-
-
+ });
+ } catch(e) {
+ }
});
function deleteCheckedItems() {
@@ -182,7 +178,7 @@ function enableOnUser(){
else {
checkedstr = $(this).val();
}
- }
+ }
});
$.post('item', { dropitems: checkedstr }, function(data) {
window.location.reload();
@@ -226,14 +222,12 @@ function enableOnUser(){
//reply = prompt("{{$expirewhen}}", $('#jot-expire').val());
$('#expiryModal').modal();
$('#expiry-modal-OKButton').on('click', function() {
- reply=$('#expiration-date').val();
- if(reply && reply.length) {
- $('#jot-expire').val(reply);
- $('#expiryModal').modal('hide');
- }
-})
-
-
+ reply=$('#expiration-date').val();
+ if(reply && reply.length) {
+ $('#jot-expire').val(reply);
+ $('#expiryModal').modal('hide');
+ }
+ })
}
function jotShare(id) {
@@ -247,7 +241,6 @@ function enableOnUser(){
$('#like-rotator-' + id).spin(false);
$(window).scrollTop(0);
});
-
});
}
@@ -292,9 +285,9 @@ function enableOnUser(){
}
function itemFiler(id) {
-
+
var bordercolor = $("input").css("border-color");
-
+
$.get('filer/', function(data){
$.colorbox({html:data});
$("#id_term").keypress(function(){
@@ -303,7 +296,7 @@ function enableOnUser(){
$("#select_term").change(function(){
$("#id_term").css("border-color",bordercolor);
})
-
+
$("#filer_save").click(function(e){
e.preventDefault();
reply = $("#id_term").val();
@@ -352,8 +345,6 @@ function enableOnUser(){
$('#profile-nolocation-wrapper').attr('disabled', true);
}
-
-
{{$geotag}}
</script>
@@ -362,16 +353,15 @@ function enableOnUser(){
$( document ).on( "click", ".wall-item-delete-link,.page-delete-link,.layout-delete-link,.block-delete-link", function(e) {
var link = $(this).attr("href"); // "get" the intended link in a var
- if (typeof(eval($.fn.modal)) === 'function'){
- e.preventDefault();
- bootbox.confirm("<h4>{{$confirmdelete}}</h4>",function(result) {
- if (result) {
- document.location.href = link;}
- });}
- else {
- return confirm("{{$confirmdelete}}");
- }
- });
+ if (typeof(eval($.fn.modal)) === 'function'){
+ e.preventDefault();
+ bootbox.confirm("<h4>{{$confirmdelete}}</h4>",function(result) {
+ if (result) {
+ document.location.href = link;
+ }
+ });
+ } else {
+ return confirm("{{$confirmdelete}}");
+ }
+});
</script>
-
-