]> git.mxchange.org Git - friendica.git/blob - view/theme/decaf-mobile/js/theme.js
Merge branch 'develop' of https://github.com/friendica/friendica into develop
[friendica.git] / view / theme / decaf-mobile / js / theme.js
1 // For Firefox < 3.6, which doesn't support document.readyState
2 // verify that document.readyState is undefined
3 // verify that document.addEventListener is there
4 // these two conditions are basically telling us
5 // we are using Firefox < 3.6
6 /*if(document.readyState == null && document.addEventListener){
7     // on DOMContentLoaded event, supported since ages
8     document.addEventListener("DOMContentLoaded", function DOMContentLoaded(){
9         // remove the listener itself
10         document.removeEventListener("DOMContentLoaded", DOMContentLoaded, false);
11         // assign readyState as complete
12         document.readyState = "complete";
13     }, false);
14     // set readyState = loading or interactive
15     // it does not really matter for this purpose
16     document.readyState = "loading";
17 }*/
18
19 document.addEventListener('DOMContentLoaded', function(){
20
21         if(typeof window.AjaxUpload != "undefined") {
22                 var uploader = new window.AjaxUpload(
23                         window.imageUploadButton,
24                         { action: 'wall_upload/'+window.nickname,
25                                 name: 'userfile',
26                                 onSubmit: function(file,ext) { $('#profile-rotator').show(); },
27                                 onComplete: function(file,response) {
28                                         var currentText = $(window.jotId).val();
29                                         $(window.jotId).val(currentText + response);
30                                         $('#profile-rotator').hide();
31                                 }                                
32                         }
33                 );
34
35                 if(document.getElementById('wall-file-upload') != null) {
36                         var file_uploader = new window.AjaxUpload(
37                                 'wall-file-upload',
38                                 { action: 'wall_attach/'+window.nickname,
39                                         name: 'userfile',
40                                         onSubmit: function(file,ext) { $('#profile-rotator').show(); },
41                                         onComplete: function(file,response) {
42                                                 var currentText = $(window.jotId).val();
43                                                 $(window.jotId).val(currentText + response);
44                                                 $('#profile-rotator').hide();
45                                         }                                
46                                 }
47                         );
48                 }
49         }
50
51 });
52
53 function confirmDelete(f) {
54         response = confirm(window.delItem);
55         if(response && typeof f == 'function') {
56                 f();
57         }
58         return response;
59 }
60
61 function changeHref(elemId, url) {
62         elem = document.getElementById(elemId);
63         elem.href = url;
64 }
65
66 function remove(elemId) {
67         elem = document.getElementById(elemId);
68         elem.parentNode.removeChild(elem);
69 }
70
71 function openClose(el) {}
72
73 // It's better to separate Javascript from the HTML, but the wall_thread
74 // items require more work to find since they contain the item ID in the id field
75 //document.getElementById('photo-album-edit-drop').onclick = function(){return confirmDelete(function(){remove('photo-album-edit-form-confirm');});}
76 //document.getElementById('photo-edit-delete-button').onclick = function(){return confirmDelete(function(){remove('photo-edit-form-confirm');});}
77