mirror of
https://github.com/friendica/friendica
synced 2025-04-26 05:50:11 +00:00
Decaf mobile: an (almost) Javascript-free theme
This commit is contained in:
parent
8e62c8b27c
commit
488a38cd85
300 changed files with 11117 additions and 328 deletions
77
view/theme/decaf-mobile/js/theme.js
Normal file
77
view/theme/decaf-mobile/js/theme.js
Normal file
|
@ -0,0 +1,77 @@
|
|||
// For Firefox < 3.6, which doesn't support document.readyState
|
||||
// verify that document.readyState is undefined
|
||||
// verify that document.addEventListener is there
|
||||
// these two conditions are basically telling us
|
||||
// we are using Firefox < 3.6
|
||||
/*if(document.readyState == null && document.addEventListener){
|
||||
// on DOMContentLoaded event, supported since ages
|
||||
document.addEventListener("DOMContentLoaded", function DOMContentLoaded(){
|
||||
// remove the listener itself
|
||||
document.removeEventListener("DOMContentLoaded", DOMContentLoaded, false);
|
||||
// assign readyState as complete
|
||||
document.readyState = "complete";
|
||||
}, false);
|
||||
// set readyState = loading or interactive
|
||||
// it does not really matter for this purpose
|
||||
document.readyState = "loading";
|
||||
}*/
|
||||
|
||||
document.addEventListener('DOMContentLoaded', function(){
|
||||
|
||||
if(typeof window.AjaxUpload != "undefined") {
|
||||
var uploader = new window.AjaxUpload(
|
||||
window.imageUploadButton,
|
||||
{ action: 'wall_upload/'+window.nickname,
|
||||
name: 'userfile',
|
||||
onSubmit: function(file,ext) { $j('#profile-rotator').show(); },
|
||||
onComplete: function(file,response) {
|
||||
var currentText = $j(window.jotId).val();
|
||||
$j(window.jotId).val(currentText + response);
|
||||
$j('#profile-rotator').hide();
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
if(document.getElementById('wall-file-upload') != null) {
|
||||
var file_uploader = new window.AjaxUpload(
|
||||
'wall-file-upload',
|
||||
{ action: 'wall_attach/'+window.nickname,
|
||||
name: 'userfile',
|
||||
onSubmit: function(file,ext) { $j('#profile-rotator').show(); },
|
||||
onComplete: function(file,response) {
|
||||
var currentText = $j(window.jotId).val();
|
||||
$j(window.jotId).val(currentText + response);
|
||||
$j('#profile-rotator').hide();
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
function confirmDelete(f) {
|
||||
response = confirm(window.delItem);
|
||||
if(response && typeof f == 'function') {
|
||||
f();
|
||||
}
|
||||
return response;
|
||||
}
|
||||
|
||||
function changeHref(elemId, url) {
|
||||
elem = document.getElementById(elemId);
|
||||
elem.href = url;
|
||||
}
|
||||
|
||||
function remove(elemId) {
|
||||
elem = document.getElementById(elemId);
|
||||
elem.parentNode.removeChild(elem);
|
||||
}
|
||||
|
||||
function openClose(el) {}
|
||||
|
||||
// It's better to separate Javascript from the HTML, but the wall_thread
|
||||
// items require more work to find since they contain the item ID in the id field
|
||||
//document.getElementById('photo-album-edit-drop').onclick = function(){return confirmDelete(function(){remove('photo-album-edit-form-confirm');});}
|
||||
//document.getElementById('photo-edit-delete-button').onclick = function(){return confirmDelete(function(){remove('photo-edit-form-confirm');});}
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue