provide a close-option for boxes in right_aside and store info via js and cookies

This commit is contained in:
tommy tomson 2012-03-27 15:29:46 +02:00
parent 1982184ca0
commit 9fd54de691
6 changed files with 195 additions and 19 deletions

View File

@ -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-blue/icons/facebook.png" title="Facebook"></a>
<a href="$url/settings/connectors"><img alt="StatusNet" src="view/theme/diabook-blue/icons/StatusNet.png?" title="StatusNet"></a>
@ -23,28 +28,36 @@
<a href="$url/settings/connectors"><img alt="E-Mail" src="view/theme/diabook-blue/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 the 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>
@ -55,21 +68,24 @@
</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>

Binary file not shown.

After

Width:  |  Height:  |  Size: 206 B

View File

@ -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);

View File

@ -1174,8 +1174,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; */
@ -1192,6 +1192,13 @@ 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;

View File

@ -1173,8 +1173,8 @@ body .pageheader{
right_aside {
display: table-cell;
vertical-align: top;
width: 160px;
padding-right: 10px;
width: 170px;
/*padding-right: 10px;*/
/*border-left: 1px solid #D2D2D2;*/
/* background: #F1F1F1; */
@ -1191,6 +1191,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;

View File

@ -147,9 +147,10 @@ function diabook_blue_community_info(){
$aside['$nv'] = $nv;
};
//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();
@ -174,10 +175,10 @@ function diabook_blue_community_info(){
$contact["name"]."</a></li>";
}
$page .= '</ul></div></div>';
if (sizeof($contacts) > 0)
//if (sizeof($contacts) > 0)
$aside['$page'] = $page;
}
//END Community Page
@ -222,31 +223,39 @@ 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_blue_community_info();
// CUSTOM CSS
$cssFile = $a->get_baseurl($ssl_state)."/view/theme/diabook-blue/style-network.css";
}
}
//right_aside at profile pages
if ($a->argv[0] === "profile"){
if($ccCookie != "8") {
// COMMUNITY
diabook_blue_community_info();
// CUSTOM CSS
$cssFile = $a->get_baseurl($ssl_state)."/view/theme/diabook-blue/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
@ -254,7 +263,98 @@ $a->page['htmlhead'] .= <<< EOT
<script>
$(function() {
$('a.lightbox').fancybox(); // Select all links with lightbox class
});
</script>
</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;