]> git.mxchange.org Git - friendica.git/commitdiff
provide a close-option for boxes in right_aside and store info via js and cookies
authortommy tomson <thomas.bierey@gmx.de>
Tue, 27 Mar 2012 17:02:07 +0000 (19:02 +0200)
committertommy tomson <thomas.bierey@gmx.de>
Tue, 27 Mar 2012 17:02:07 +0000 (19:02 +0200)
view/theme/diabook/communityhome.tpl
view/theme/diabook/icons/close_box.png [new file with mode: 0755]
view/theme/diabook/icons/expand.png [deleted file]
view/theme/diabook/js/jquery.cookie.js [new file with mode: 0644]
view/theme/diabook/profile_side.tpl
view/theme/diabook/style-network.css
view/theme/diabook/style-profile.css
view/theme/diabook/style.css
view/theme/diabook/theme.php

index 7e50423ce2ce0f080b691baafc6085b6caefb1c3..3e644169257384dcca826740e49634ccaaac42a1 100755 (executable)
@@ -1,17 +1,22 @@
+<div id="close_pages">
 {{ if $page }}
 <div>$page</div>
 {{ endif }}
+</div>
 
+<div id="close_helpers">
 {{ if $lastusers_title }}
-<h3 style="margin-top:0px;">Help or @NewHere ?</h3>
+<h3 style="margin-top:0px;">Help or @NewHere ?<a id="close_helpers_icon"  onClick="close_helpers()" class="icon close_box"></a></h3>
 <a href="https://helpers.pyxis.uberspace.de/profile/helpers" style="margin-left: 10px; " title="Friendica Support" target="blank">Friendica Support</a><br>
 <a href="https://letstalk.pyxis.uberspace.de/profile/letstalk" style="margin-left: 10px; " title="Let's talk" target="blank">Let's talk</a><br>
 <a href="http://newzot.hydra.uberspace.de/profile/newzot" title="Local Friendica" style="margin-left: 10px; " target="blank">Local Friendica</a>
 <a href="http://kakste.com/profile/newhere" title="@NewHere" style="margin-left: 10px; " target="blank">NewHere</a>
 {{ endif }}
+</div>
 
+<div id="close_services">
 {{ if $lastusers_title }}
-<h3>Connectable Services</h3>
+<h3>Connectable Services<a id="close_services_icon" onClick="close_services()" class="icon close_box"></a></h3>
 <div id="right_service_icons" style="margin-left: 11px; margin-top: 5px;">
 <a href="$url/facebook"><img alt="Facebook" src="view/theme/diabook/icons/facebook.png" title="Facebook"></a>
 <a href="$url/settings/connectors"><img alt="StatusNet" src="view/theme/diabook/icons/StatusNet.png?" title="StatusNet"></a>
 <a href="$url/settings/connectors"><img alt="E-Mail" src="view/theme/diabook/icons/email.png?" title="E-Mail"></a>
 </div>
 {{ endif }}
+</div>
 
+<div id="close_friends">
 {{ if $nv }}
-<h3>Find Friends</h3>
+<h3>Find Friends<a id="close_friends_icon" onClick="close_friends()"  class="icon close_box"></a></h3>
 <a class="$nv.directory.2" href="$nv.directory.0" style="margin-left: 10px; " title="$nv.directory.3" >$nv.directory.1</a><br>
 <a class="$nv.match.2" href="$nv.match.0" style="margin-left: 10px; " title="$nv.match.3" >$nv.match.1</a><br>
 <a class="$nv.suggest.2" href="$nv.suggest.0" style="margin-left: 10px; " title="$nv.suggest.3" >$nv.suggest.1</a>
 <a class="$nv.invite.2" href="$nv.invite.0" style="margin-left: 10px; " title="$nav.invite.3" >$nv.invite.1</a>                        
 {{ endif }}
+</div>
 
+<div id="close_postit">
 {{ if $lastusers_title }}
-<h3>PostIt to Friendica</h3>
+<h3>PostIt to Friendica<a id="close_postit_icon" onClick="close_postit()" class="icon close_box"></a></h3>
 <div style="padding-left: 8px;"><span ><a href="$fostitJS" title="PostIt">Post to Friendica</a> from anywhere by bookmarking this Link.</span></div>
 {{ endif }}
+</div>
 
+<div id="close_lastusers">
 {{ if $lastusers_title }}
-<h3>$lastusers_title</h3>
+<h3>$lastusers_title<a id="close_lastusers_icon" onClick="close_lastusers()" class="icon close_box"></a></h3>
 <div id='lastusers-wrapper' class='items-wrapper'>
 {{ for $lastusers_items as $i }}
        $i
 {{ endfor }}
 </div>
 {{ endif }}
+</div>
 
 {{ if $activeusers_title }}
 <h3>$activeusers_title</h3>
 </div>
 {{ endif }}
 
+<div id="close_lastphotos">
 {{ if $photos_title }}
-<h3>$photos_title</h3>
+<h3>$photos_title<a id="close_photos_icon" onClick="close_lastphotos()"  class="icon close_box"></a></h3>
 <div id='ra-photos-wrapper' class='items-wrapper'>
 {{ for $photos_items as $i }}
        $i
 {{ endfor }}
 </div>
 {{ endif }}
+</div>
 
+<div id="close_lastlikes">
 {{ if $like_title }}
-<h3>$like_title</h3>
+<h3>$like_title<a id="close_lastlikes_icon" onClick="close_lastlikes()" class="icon close_box"></a></h3>
 <ul id='likes'>
 {{ for $like_items as $i }}
        <li id='ra-photos-wrapper'>$i</li>
 {{ endfor }}
 </ul>
 {{ endif }}
+</div>
diff --git a/view/theme/diabook/icons/close_box.png b/view/theme/diabook/icons/close_box.png
new file mode 100755 (executable)
index 0000000..28e2675
Binary files /dev/null and b/view/theme/diabook/icons/close_box.png differ
diff --git a/view/theme/diabook/icons/expand.png b/view/theme/diabook/icons/expand.png
deleted file mode 100755 (executable)
index a46e88e..0000000
Binary files a/view/theme/diabook/icons/expand.png and /dev/null differ
diff --git a/view/theme/diabook/js/jquery.cookie.js b/view/theme/diabook/js/jquery.cookie.js
new file mode 100644 (file)
index 0000000..6d5974a
--- /dev/null
@@ -0,0 +1,47 @@
+/*!
+ * jQuery Cookie Plugin
+ * https://github.com/carhartl/jquery-cookie
+ *
+ * Copyright 2011, Klaus Hartl
+ * Dual licensed under the MIT or GPL Version 2 licenses.
+ * http://www.opensource.org/licenses/mit-license.php
+ * http://www.opensource.org/licenses/GPL-2.0
+ */
+(function($) {
+    $.cookie = function(key, value, options) {
+
+        // key and at least value given, set cookie...
+        if (arguments.length > 1 && (!/Object/.test(Object.prototype.toString.call(value)) || value === null || value === undefined)) {
+            options = $.extend({}, options);
+
+            if (value === null || value === undefined) {
+                options.expires = -1;
+            }
+
+            if (typeof options.expires === 'number') {
+                var days = options.expires, t = options.expires = new Date();
+                t.setDate(t.getDate() + days);
+            }
+
+            value = String(value);
+
+            return (document.cookie = [
+                encodeURIComponent(key), '=', options.raw ? value : encodeURIComponent(value),
+                options.expires ? '; expires=' + options.expires.toUTCString() : '', // use expires attribute, max-age is not supported by IE
+                options.path    ? '; path=' + options.path : '',
+                options.domain  ? '; domain=' + options.domain : '',
+                options.secure  ? '; secure' : ''
+            ].join(''));
+        }
+
+        // key and possibly options given, get cookie...
+        options = value || {};
+        var decode = options.raw ? function(s) { return s; } : decodeURIComponent;
+
+        var pairs = document.cookie.split('; ');
+        for (var i = 0, pair; pair = pairs[i] && pairs[i].split('='); i++) {
+            if (decode(pair[0]) === key) return decode(pair[1] || ''); // IE saves cookies with empty string as "c; ", e.g. without "=" as opposed to EOMB, thus pair[1] may be undefined
+        }
+        return null;
+    };
+})(jQuery);
index fc949639ea2623fcc9597699bf17f12758e4f917..0762dbe449eaf574f56ac99d5e05560d028ad415 100644 (file)
@@ -9,7 +9,7 @@
 <ul id="profile-side-menu" class="menu-profile-side">
        <li id="profile-side-status" class="menu-profile-list home"><a class="menu-profile-list-item" href="$ps.usermenu.status.0">$ps.usermenu.status.1</a></li>
        <li id="profile-side-photos" class="menu-profile-list photos"><a class="menu-profile-list-item" href="$ps.usermenu.photos.0">$ps.usermenu.photos.1</a></li>
-               <li id="profile-side-photos" class="menu-profile-list pscontacts"><a class="menu-profile-list-item" href="$ps.usermenu.contacts.0">$ps.usermenu.contacts.1</a></li>             
+       <li id="profile-side-photos" class="menu-profile-list pscontacts"><a class="menu-profile-list-item" href="$ps.usermenu.contacts.0">$ps.usermenu.contacts.1</a></li>             
        <li id="profile-side-events" class="menu-profile-list events"><a class="menu-profile-list-item" href="$ps.usermenu.events.0">$ps.usermenu.events.1</a></li>
        <li id="profile-side-notes" class="menu-profile-list notes"><a class="menu-profile-list-item" href="$ps.usermenu.notes.0">$ps.usermenu.notes.1</a></li>
        <li id="profile-side-foren" class="menu-profile-list foren"><a class="menu-profile-list-item" href="$ps.usermenu.pgroups.0" target="blanc">$ps.usermenu.pgroups.1</a></li>
index 20c273ec30677d147b041ede03297e37f7efcc58..f322aac8ffea6e288149749e871da704e45bed72 100644 (file)
@@ -909,25 +909,25 @@ ul.menu-popup .empty {
    }
 /*http://prothemedesign.com/circular-icons/*/
 .menu-profile-list.home{
-       background: url("../../../view/theme/diabook-blue/icons/home.png") no-repeat;
+       background: url("../../../view/theme/diabook/icons/home.png") no-repeat;
        }
 .menu-profile-list.photos{
-       background: url("../../../view/theme/diabook-blue/icons/mess_side.png") no-repeat;
+       background: url("../../../view/theme/diabook/icons/mess_side.png") no-repeat;
        }
 .menu-profile-list.events{
-       background: url("../../../view/theme/diabook-blue/icons/events.png") no-repeat;
+       background: url("../../../view/theme/diabook/icons/events.png") no-repeat;
        }
 .menu-profile-list.notes{
-       background: url("../../../view/theme/diabook-blue/icons/notes.png") no-repeat;
+       background: url("../../../view/theme/diabook/icons/notes.png") no-repeat;
        }
 .menu-profile-list.foren{
-       background: url("../../../view/theme/diabook-blue/icons/pubgroups.png") no-repeat;
+       background: url("../../../view/theme/diabook/icons/pubgroups.png") no-repeat;
        }
 .menu-profile-list.com_side{
-       background: url("../../../view/theme/diabook-blue/icons/com_side.png") no-repeat;
+       background: url("../../../view/theme/diabook/icons/com_side.png") no-repeat;
        }
 .menu-profile-list.pscontacts{
-       background: url("../../../view/theme/diabook-blue/icons/pscontacts.png") no-repeat;
+       background: url("../../../view/theme/diabook/icons/pscontacts.png") no-repeat;
        }
 
 /* aside */
@@ -1156,8 +1156,7 @@ body .pageheader{
 right_aside {
   display: table-cell;
   vertical-align: top;
-  width: 160px;
-  padding-right: 10px;
+  width: 170px;
   /*border-left: 1px solid #D2D2D2;*/
   
   /* background: #F1F1F1; */
@@ -1173,8 +1172,9 @@ right_aside #lastusers-wrapper { padding-left: 6px; padding-top: 3px; overflow:
 right_aside #ra-photos-wrapper { padding-left: 5px; padding-top: 3px; overflow: auto;  width: 100%; }
 #page-sidebar-right_aside{margin-top: 0px; margin-bottom: 30px;}
 #page-sidebar-right_aside ul {margin-top: 0px;}
-.icon.expand           { 
-               background-image: url("../../../view/theme/diabook/icons/expand.png");
+right_aside .icon {width: 10px; height: 10px;}
+.close_box             { 
+               background-image: url("../../../view/theme/diabook-blue/icons/close_box.png");
                float: right;
                cursor: pointer;
                }
index 0f05bf6c1b70cf46e3eacbb42e6cfa49064386eb..7020ee4a00ef02a49016786cea1b88594f040e20 100644 (file)
@@ -1151,8 +1151,8 @@ body .pageheader{
 right_aside {
   display: table-cell;
   vertical-align: top;
-  width: 160px;
-  padding-right: 10px;
+  width: 170px;
+  
   /*border-left: 1px solid #D2D2D2;*/
   
   /* background: #F1F1F1; */
@@ -1168,6 +1168,12 @@ right_aside #lastusers-wrapper { padding-left: 6px; padding-top: 3px; overflow:
 right_aside #ra-photos-wrapper { padding-left: 5px; padding-top: 3px; overflow: auto;  width: 100%; }
 #page-sidebar-right_aside{margin-top: 0px; margin-bottom: 30px;}
 #page-sidebar-right_aside ul {margin-top: 0px;}
+right_aside .icon {width: 10px; height: 10px;}
+.close_box             { 
+               background-image: url("../../../view/theme/diabook-blue/icons/close_box.png");
+               float: right;
+               cursor: pointer;
+               }
 /* wall item */
 .tread-wrapper {
   border-bottom: 1px solid #D2D2D2;
index 5154459d3a8759fdb57e3d703b580c739d6eacc4..d964243a93ad600c3edb4020e19247b6502cfbe8 100644 (file)
@@ -924,6 +924,9 @@ ul.menu-popup .empty {
 .menu-profile-list.com_side{
        background: url("../../../view/theme/diabook-blue/icons/com_side.png") no-repeat;
        }
+.menu-profile-list.pscontacts{
+       background: url("../../../view/theme/diabook/icons/pscontacts.png") no-repeat;
+       }
 
 /* aside */
 aside {
index 6eb623d9536cabe87723ba7c3dcb5b72886f34f5..5a447cc9bc49e3a44e5fad7e2c4a7a279613dc8d 100755 (executable)
@@ -151,9 +151,10 @@ function diabook_community_info(){
        };
    
    //Community Page
+   if(local_user()) {
    $page = '<div id="page-sidebar-right_aside" class="widget">
                        <div class="title tool">
-                       <h3>'.t("Community Pages").'</h3></div>
+                       <h3>'.t("Community Pages").'<a id="close_pages_icon"  onClick="close_pages()" class="icon close_box"></a></h3></div>
                        <div id="sidebar-page-list"><ul>';
 
        $pagelist = array();
@@ -178,9 +179,10 @@ function diabook_community_info(){
                                $contact["name"]."</a></li>";
        }
        $page .= '</ul></div></div>';
-       if (sizeof($contacts) > 0)
+       //if (sizeof($contacts) > 0)
                
-               $aside['$page'] = $page;
+               $aside['$page'] = $page;        
+       }
   //END Community Page         
      
    
@@ -227,31 +229,38 @@ if ($a->argv[0] === "network" && local_user()){
 
        }
        
+       $ccCookie = $_COOKIE['close_pages'] + $_COOKIE['close_helpers'] + $_COOKIE['close_services'] + $_COOKIE['close_friends'] + $_COOKIE['close_postit'] + $_COOKIE['close_lastusers'] + $_COOKIE['close_lastphotos'] + $_COOKIE['close_lastlikes'];
+       
+       if($ccCookie != "8") {
        // COMMUNITY
        diabook_community_info();
        
        // CUSTOM CSS
        $cssFile = $a->get_baseurl($ssl_state)."/view/theme/diabook/style-network.css";
-       
+       }
 }
 
 
 
 //right_aside at profile pages
 if ($a->argv[0] === "profile"){
-       
+       if($ccCookie != "8") {
        // COMMUNITY
        diabook_community_info();
        
        // CUSTOM CSS
        $cssFile = $a->get_baseurl($ssl_state)."/view/theme/diabook/style-profile.css";
-       
+       }
 }
 
 
 // custom css
 if (!is_null($cssFile)) $a->page['htmlhead'] .= sprintf('<link rel="stylesheet" type="text/css" href="%s" />', $cssFile);
 
+//load jquery.cookie.js
+$cookieJS = $a->get_baseurl($ssl_state)."/view/theme/diabook-blue/js/jquery.cookie.js";
+$a->page['htmlhead'] .= sprintf('<script language="JavaScript" src="%s" />', $cookieJS);
+
 //js scripts
 
 $a->page['htmlhead'] .= <<< EOT
@@ -262,5 +271,95 @@ $a->page['htmlhead'] .= <<< EOT
  });
   
  </script>
+
+<script>
+
+$("right_aside").ready(function(){
+       
+       if($.cookie('close_pages') == '1') 
+               {
+               document.getElementById( "close_pages" ).style.display = "none";
+                       };
+       
+       if($.cookie('close_helpers') == '1') 
+               {
+               document.getElementById( "close_helpers" ).style.display = "none";
+                       };
+                       
+       if($.cookie('close_services') == '1') 
+               {
+               document.getElementById( "close_services" ).style.display = "none";
+                       };
+                       
+       if($.cookie('close_friends') == '1') 
+               {
+               document.getElementById( "close_friends" ).style.display = "none";
+                       };
+       
+       if($.cookie('close_postit') == '1') 
+               {
+               document.getElementById( "close_postit" ).style.display = "none";
+                       };
+                       
+       if($.cookie('close_lastusers') == '1') 
+               {
+               document.getElementById( "close_lastusers" ).style.display = "none";
+                       };
+                       
+       if($.cookie('close_lastphotos') == '1') 
+               {
+               document.getElementById( "close_lastphotos" ).style.display = "none";
+                       };
+                       
+       if($.cookie('close_lastlikes') == '1') 
+               {
+               document.getElementById( "close_lastlikes" ).style.display = "none";
+                       };}
+
+);
+
+function close_pages(){
+ document.getElementById( "close_pages" ).style.display = "none";
+ $.cookie('close_pages','1', { expires: 365, path: '/' });
+ };
+function close_helpers(){
+ document.getElementById( "close_helpers" ).style.display = "none";
+  $.cookie('close_helpers','1', { expires: 365, path: '/' });
+ };
+
+function close_services(){
+ document.getElementById( "close_services" ).style.display = "none";
+ $.cookie('close_services','1', { expires: 365, path: '/' });
+ };
+function close_friends(){
+ document.getElementById( "close_friends" ).style.display = "none";
+ $.cookie('close_friends','1', { expires: 365, path: '/' });
+ };
+
+function close_postit(){
+ document.getElementById( "close_postit" ).style.display = "none";
+ $.cookie('close_postit','1', { expires: 365, path: '/' });
+ };
+function close_lastusers(){
+ document.getElementById( "close_lastusers" ).style.display = "none";
+ $.cookie('close_lastusers','1', { expires: 365, path: '/' });
+ };
+
+function close_lastphotos(){
+ document.getElementById( "close_lastphotos" ).style.display = "none";
+ $.cookie('close_lastphotos','1', { expires: 365, path: '/' });
+ };
+function close_lastlikes(){
+ document.getElementById( "close_lastlikes" ).style.display = "none";
+ $.cookie('close_lastlikes','1', { expires: 365, path: '/' });
+ };
+</script>
 EOT;