]> git.mxchange.org Git - friendica.git/blobdiff - view/theme/frost/js/theme.js
Merge pull request #2949 from silke/vagrant-1604
[friendica.git] / view / theme / frost / js / theme.js
index 5d61d5ae892987ae06b45897dbffbf4ddaff5638..57124bce09a8d0c084f5895c7f6f725798d18456 100644 (file)
@@ -70,9 +70,9 @@ $(document).ready(function() {
                return false;
        });*/
 
-       $('#event-share-checkbox').change(function() {
+       $('#id_share').change(function() {
 
-               if ($('#event-share-checkbox').is(':checked')) { 
+               if ($('#id_share').is(':checked')) { 
                        $('#acl-wrapper').show();
                }
                else {
@@ -149,7 +149,7 @@ $(document).ready(function() {
 
        if(window.aclType == "event_head") {
                $('#events-calendar').fullCalendar({
-                       events: baseurl + '/events/json/',
+                       events: baseurl + window.eventModuleUrl +'/json/',
                        header: {
                                left: 'prev,next today',
                                center: 'title',
@@ -159,13 +159,18 @@ $(document).ready(function() {
                        eventClick: function(calEvent, jsEvent, view) {
                                showEvent(calEvent.id);
                        },
+                       loading: function(isLoading, view) {
+                               if(!isLoading) {
+                                       $('td.fc-day').dblclick(function() { window.location.href='/events/new?start='+$(this).data('date'); });
+                               }
+                       },
                        
                        eventRender: function(event, element, view) {
                                //console.log(view.name);
                                if (event.item['author-name']==null) return;
                                switch(view.name){
                                        case "month":
-                                       element.find(".fc-event-title").html(
+                                       element.find(".fc-title").html(
                                                "<img src='{0}' style='height:10px;width:10px'>{1} : {2}".format(
                                                        event.item['author-avatar'],
                                                        event.item['author-name'],
@@ -173,7 +178,7 @@ $(document).ready(function() {
                                        ));
                                        break;
                                        case "agendaWeek":
-                                       element.find(".fc-event-title").html(
+                                       element.find(".fc-title").html(
                                                "<img src='{0}' style='height:12px; width:12px'>{1}<p>{2}</p><p>{3}</p>".format(
                                                        event.item['author-avatar'],
                                                        event.item['author-name'],
@@ -182,7 +187,7 @@ $(document).ready(function() {
                                        ));
                                        break;
                                        case "agendaDay":
-                                       element.find(".fc-event-title").html(
+                                       element.find(".fc-title").html(
                                                "<img src='{0}' style='height:24px;width:24px'>{1}<p>{2}</p><p>{3}</p>".format(
                                                        event.item['author-avatar'],
                                                        event.item['author-name'],
@@ -197,10 +202,12 @@ $(document).ready(function() {
                
                // center on date
                var args=location.href.replace(baseurl,"").split("/");
-               if (args.length>=4) {
+               if (args.length>=5 && window.eventModeParams == 2) {
+                       $("#events-calendar").fullCalendar('gotoDate',args[3] , args[4]-1);
+               } else if (args.length>=4 && window.eventModeParams == 1) {
                        $("#events-calendar").fullCalendar('gotoDate',args[2] , args[3]-1);
-               } 
-               
+               }
+
                // show event popup
                var hash = location.hash.split("-")
                if (hash.length==2 && hash[0]=="#link") showEvent(hash[1]);
@@ -209,25 +216,27 @@ $(document).ready(function() {
 
        switch(window.autocompleteType) {
                case 'msg-header':
-                       var a = $("#recip").autocomplete({ 
-                               serviceUrl: baseurl + '/acl',
-                               minChars: 2,
-                               width: 350,
-                               onSelect: function(value,data) {
-                                       $("#recip-complete").val(data);
-                               }                       
+                       $("#recip").name_autocomplete(baseurl + '/acl', '', false, function(data) {
+                                       $("#recip-complete").val(data.id);
                        });
                        break;
                case 'contacts-head':
-                       var a = $("#contacts-search").autocomplete({ 
-                               serviceUrl: baseurl + '/acl',
-                               minChars: 2,
-                               width: 350,
+                       $("#contacts-search").contact_autocomplete(baseurl + '/acl', 'a', true);
+
+
+                       $("#contacts-search").keyup(function(event){
+                               if(event.keyCode == 13){
+                                       $("#contacts-search").click();
+                               }
+                       });
+                       $(".autocomplete-w1 .selected").keyup(function(event){
+                               if(event.keyCode == 13){
+                                       $("#contacts-search").click();
+                               }
                        });
-                       a.setOptions({ params: { type: 'a' }});
                        break;
                case 'display-head':
-                       $(".comment-wwedit-wrapper textarea").contact_autocomplete(baseurl+"/acl");
+                       $(".comment-wwedit-wrapper textarea").editor_autocomplete(baseurl+"/acl");
                        break;
                default:
                        break;
@@ -345,7 +354,7 @@ if(typeof window.photoEdit != 'undefined') {
 
 function showEvent(eventid) {
        $.get(
-               baseurl + '/events/?id='+eventid,
+               baseurl + window.eventModuleUrl + '/?id=' + eventid,
                function(data){
                        $.colorbox({html:data});
                        $.colorbox.resize();
@@ -353,6 +362,14 @@ function showEvent(eventid) {
        );                      
 }
 
+function doEventPreview() {
+        $('#event-edit-preview').val(1);
+        $.post('events',$('#event-edit-form').serialize(), function(data) {
+                $.colorbox({ html: data });
+        });
+        $('#event-edit-preview').val(0);
+}
+
 function initCrop() {
        function onEndCrop( coords, dimensions ) {
                $PR( 'x1' ).value = coords.x1;
@@ -574,7 +591,7 @@ function initEditor(cb){
                        plaintextFn : function() {
                                $("#profile-jot-text-loading").hide();
                                $("#profile-jot-text").css({ 'height': 200, 'color': '#000' });
-                               $("#profile-jot-text").contact_autocomplete(baseurl+"/acl");
+                               $("#profile-jot-text").editor_autocomplete(baseurl+"/acl");
                                $(".jothidden").show();
                                if (typeof cb!="undefined") cb();
                        }
@@ -647,7 +664,7 @@ function msgInitEditor() {
                        });
                },
                plaintextFn : function() {
-                       $("#prvmail-text").contact_autocomplete(baseurl+"/acl");
+                       $("#prvmail-text").editor_autocomplete(baseurl+"/acl");
                }
        }
        InitMCEEditor(editorData);