]> git.mxchange.org Git - friendica.git/blobdiff - view/theme/frost/js/theme.js
Merge pull request #593 from fermionic/20130127-tinymce-update-and-fixes
[friendica.git] / view / theme / frost / js / theme.js
index e17a47843a25c9387d1be28de80faaf73b0a0bdc..b0d6f493131c4545dc913feb4b84ec259805c93d 100644 (file)
@@ -17,7 +17,7 @@ $j(document).ready(function() {
     });*/
 
 
-       if(typeof acl=="undefined"){
+       if(typeof window.aclInit !="undefined" && typeof acl=="undefined"){
                acl = new ACL(
                        baseurl+"/acl",
                        [ window.allowCID,window.allowGID,window.denyCID,window.denyGID ]
@@ -29,10 +29,10 @@ $j(document).ready(function() {
        $j("#profile-jot-text").click(enableOnUser);
 
 
-       $j('.nav-menu-link').hover(function() {
-               showNavMenu($j(this).attr('rel'));
+       $j('.nav-menu-list, .nav-menu-icon').hover(function() {
+               showNavMenu($j(this).attr('point'));
        }, function() {
-               hideNavMenu($j(this).attr('rel'));
+               hideNavMenu($j(this).attr('point'));
        });
 
 /*     $j('html').click(function() { $j("#nav-notifications-menu" ).hide(); });*/
@@ -78,6 +78,13 @@ $j(document).ready(function() {
                return false;
        });*/
 
+       if(window.autoCompleteType == "display-head") {
+               //$j(".comment-edit-wrapper textarea").contact_autocomplete(baseurl+"/acl");
+               // make auto-complete work in more places
+               //$j(".wall-item-comment-wrapper textarea").contact_autocomplete(baseurl+"/acl");
+               $j(".comment-wwedit-wrapper textarea").contact_autocomplete(baseurl+"/acl");
+       }
+
        if(window.aclType == "event_head") {
                $j('#events-calendar').fullCalendar({
                        events: baseurl + '/events/json/',
@@ -268,6 +275,7 @@ $j(function(){
                autoDimensions: false,
                onStart: function(){
                        var theme = $j("#id_theme :selected").val();
+                       var theme_mobile = $j("#id_theme_mobile :selected").val();
                        $j("#cnftheme").attr('href', baseurl + "/admin/themes/"+theme);
                }, 
                onComplete: function(){
@@ -297,6 +305,13 @@ $j(function(){
 });
 
 
+function homeRedirect() {
+       $j('html').fadeOut('slow', function(){
+               window.location = baseurl + "/login";
+       });
+}
+
+
 if(typeof window.photoEdit != 'undefined') {
 
        $j(document).keydown(function(event) {
@@ -500,14 +515,14 @@ function insertFormatting(comment,BBcode,id) {
                textarea.focus();
                selected = document.selection.createRange();
                if (BBcode == "url"){
-                       selected.text = "["+BBcode+"]" + "http://" +  selected.text + "[/"+BBcode+"]";
+                       selected.text = "["+BBcode+"=http://]" +  selected.text + "[/"+BBcode+"]";
                        } else                  
                selected.text = "["+BBcode+"]" + selected.text + "[/"+BBcode+"]";
        } else if (textarea.selectionStart || textarea.selectionStart == "0") {
                var start = textarea.selectionStart;
                var end = textarea.selectionEnd;
                if (BBcode == "url"){
-                       textarea.value = textarea.value.substring(0, start) + "["+BBcode+"]" + "http://" + textarea.value.substring(start, end) + "[/"+BBcode+"]" + textarea.value.substring(end, textarea.value.length);
+                       textarea.value = textarea.value.substring(0, start) + "["+BBcode+"=http://]" + textarea.value.substring(start, end) + "[/"+BBcode+"]" + textarea.value.substring(end, textarea.value.length);
                        } else
                textarea.value = textarea.value.substring(0, start) + "["+BBcode+"]" + textarea.value.substring(start, end) + "[/"+BBcode+"]" + textarea.value.substring(end, textarea.value.length);
        }
@@ -515,10 +530,10 @@ function insertFormatting(comment,BBcode,id) {
 }
 
 function cmtBbOpen(id) {
-       $j(".comment-edit-bb-" + id).show();
+       $j("#comment-edit-bb-" + id).show();
 }
 function cmtBbClose(id) {
-       $j(".comment-edit-bb-" + id).hide();
+       $j("#comment-edit-bb-" + id).hide();
 }
 
 function confirmDelete() { return confirm(window.delItem); }
@@ -576,16 +591,14 @@ function qCommentInsert(obj,id) {
        $j(obj).val("");
 }
 
-function showHideComments(id) {
-       if( $j("#collapsed-comments-" + id).is(":visible")) {
-               $j("#collapsed-comments-" + id).hide();
-               $j("#hide-comments-" + id).html(window.showMore);
+/*function showHideCommentBox(id) {
+       if( $j('#comment-edit-form-' + id).is(':visible')) {
+               $j('#comment-edit-form-' + id).hide();
        }
        else {
-               $j("#collapsed-comments-" + id).show();
-               $j("#hide-comments-" + id).html(window.showFewer);
+               $j('#comment-edit-form-' + id).show();
        }
-}
+}*/
 
 
 
@@ -610,8 +623,8 @@ function initEditor(cb){
                        $j("#profile-jot-text").contact_autocomplete(baseurl+"/acl");
                        editor = true;
                        $j("a#jot-perms-icon").fancybox({
-                               'transitionIn' : 'elastic',
-                               'transitionOut' : 'elastic'
+                               'transitionIn' : 'none', //'elastic',
+                               'transitionOut' : 'none' //'elastic'
                        });
                        $j(".jothidden").show();
                        if (typeof cb!="undefined") cb();
@@ -634,9 +647,9 @@ function initEditor(cb){
                        entity_encoding : "raw",
                        add_unload_trigger : false,
                        remove_linebreaks : false,
-                       force_p_newlines : false,
-                       force_br_newlines : true,
-                       forced_root_block : '',
+                       //force_p_newlines : false,
+                       //force_br_newlines : true,
+                       forced_root_block : 'div',
                        convert_urls: false,
                        content_css: window.baseURL + "/view/custom_tinymce.css",
                        theme_advanced_path : false,
@@ -729,9 +742,9 @@ function msgInitEditor() {
                        entity_encoding : "raw",
                        add_unload_trigger : false,
                        remove_linebreaks : false,
-                       force_p_newlines : false,
-                       force_br_newlines : true,
-                       forced_root_block : '',
+                       //force_p_newlines : false,
+                       //force_br_newlines : true,
+                       forced_root_block : 'div',
                        convert_urls: false,
                        content_css: baseurl + "/view/custom_tinymce.css",
                             //Character count
@@ -770,9 +783,9 @@ function profInitEditor() {
                entity_encoding : "raw",
                add_unload_trigger : false,
                remove_linebreaks : false,
-               force_p_newlines : false,
-               force_br_newlines : true,
-               forced_root_block : '',
+               //force_p_newlines : false,
+               //force_br_newlines : true,
+               forced_root_block : 'div',
                content_css: baseurl + "/view/custom_tinymce.css",
                theme_advanced_path : false,
                setup : function(ed) {
@@ -800,9 +813,9 @@ function eventInitEditor() {
                entity_encoding : "raw",
                add_unload_trigger : false,
                remove_linebreaks : false,
-               force_p_newlines : false,
-               force_br_newlines : true,
-               forced_root_block : '',
+               //force_p_newlines : false,
+               //force_br_newlines : true,
+               forced_root_block : 'div',
                content_css: baseurl + "/view/custom_tinymce.css",
                theme_advanced_path : false,
                setup : function(ed) {
@@ -830,9 +843,9 @@ function contactInitEditor () {
                entity_encoding : "raw",
                add_unload_trigger : false,
                remove_linebreaks : false,
-               force_p_newlines : false,
-               force_br_newlines : true,
-               forced_root_block : '',
+               //force_p_newlines : false,
+               //force_br_newlines : true,
+               forced_root_block : 'div',
                content_css: baseurl + "/view/custom_tinymce.css"
 
 
@@ -859,9 +872,9 @@ function wallInitEditor() {
                        entity_encoding : "raw",
                        add_unload_trigger : false,
                        remove_linebreaks : false,
-                       force_p_newlines : false,
-                       force_br_newlines : true,
-                       forced_root_block : '',
+                       //force_p_newlines : false,
+                       //force_br_newlines : true,
+                       forced_root_block : 'div',
                        convert_urls: false,
                        content_css: baseurl + "/view/custom_tinymce.css",
                                 //Character count
@@ -883,22 +896,26 @@ function wallInitEditor() {
                $j("#prvmail-text").contact_autocomplete(baseurl+"/acl");
 }
 
-function deleteCheckedItems() {
-       var checkedstr = '';
+function deleteCheckedItems(delID) {
+       if(confirm(window.delItems)) {
+               var checkedstr = '';
 
-       $j('.item-select').each( function() {
-               if($j(this).is(':checked')) {
-                       if(checkedstr.length != 0) {
-                               checkedstr = checkedstr + ',' + $j(this).val();
-                       }
-                       else {
-                               checkedstr = $j(this).val();
-                       }
-               }       
-       });
-       $j.post('item', { dropitems: checkedstr }, function(data) {
-               window.location.reload();
-       });
+               $j(delID).hide();
+               $j(delID + '-rotator').show();
+               $j('.item-select').each( function() {
+                       if($j(this).is(':checked')) {
+                               if(checkedstr.length != 0) {
+                                       checkedstr = checkedstr + ',' + $j(this).val();
+                               }
+                               else {
+                                       checkedstr = $j(this).val();
+                               }
+                       }       
+               });
+               $j.post('item', { dropitems: checkedstr }, function(data) {
+                       window.location.reload();
+               });
+       }
 }
 
 
@@ -918,6 +935,37 @@ function jotAudioURL() {
 
 
 function jotGetLocation() {
+
+/*     if(navigator.geolocation) {
+
+               navigator.geolocation.getCurrentPosition(function(position) {
+                       var lat = position.coords.latitude;
+                       var lng = position.coords.longitude;
+
+                       $j.ajax({
+                               type: 'GET',
+                               url: 'http://nominatim.openstreetmap.org/reverse?format=json&lat='+lat+'&lon='+lng,
+                               jsonp: 'json_callback',
+                               contentType: 'application/json',
+                               dataType: 'jsonp',
+                               success: function(json) {
+                                       console.log(json);
+                                       var locationDisplay = json.address.building+', '+json.address.city+', '+json.address.state;
+                                       $j('#jot-location').val(locationDisplay);
+                                       $j('#jot-display-location').html('Location: '+locationDisplay);
+                                       $j('#jot-display-location').show();
+                               }
+                       });
+               });
+
+       }
+       else {
+               reply = prompt(window.whereAreU, $j('#jot-location').val());
+               if(reply && reply.length) {
+                       $j('#jot-location').val(reply);
+               }
+       }*/
+
        reply = prompt(window.whereAreU, $j('#jot-location').val());
        if(reply && reply.length) {
                $j('#jot-location').val(reply);