5 * Description: Dispy family (light, dark): Sleek and Functional Themes
7 * Author: Simon <http://simon.kisikew.org/>
8 * Maintainer: Simon <http://simon.kisikew.org/>
9 * Screenshot: <a href="screenshot.jpg">Screenshot</a>
12 /* If you borrow any of these functions, make sure to
13 * RENAME your functions, otherwise both themes get conflicts,
14 * and the friendica instance will get HTTP 500 errors.
15 * To paraphrase Mike: "Might wish to wrap
16 * function_name with "if(! function_exists('function_name')) ... "
17 * or rename to prefix1_function_name (prefix2_function_name), etc.
21 $a->theme_info = array(
25 set_template_engine($a, 'smarty3');
27 function dispy_init(&$a) {
29 /** @purpose set some theme defaults
32 $colour = get_pconfig(local_user(), "dispy", "colour");
33 $baseurl = $a->get_baseurl($ssl_state);
35 if ($colour === false) { $colour = "light"; }
36 if ($colour == "light") {
37 $colour_path = "/light/";
38 require_once ('light/theme.php');
40 if ($colour == "dark") {
41 $colour_path = "/dark/";
42 require_once ('dark/theme.php');
45 /** @purpose aside on profile page
47 if (($a->argv[0] . $a->argv[1]) === ("profile" . $a->user['nickname'])) {
48 dispy_community_info();
51 $a->page['htmlhead'] .= <<<EOT
52 <script type="text/javascript" src="$baseurl/view/theme/dispy/js/modernizr.custom.2.5.3.min.js"></script>
53 <script type="text/javascript">
54 $(document).ready(function() {
55 // Select all links with lightbox class
56 $("a.lightbox").fancybox();
58 $('.group-edit-icon').hover(
60 $(this).addClass('icon');
61 $(this).removeClass('iconspacer'); },
64 $(this).removeClass('icon');
65 $(this).addClass('iconspacer'); }
68 $('.sidebar-group-element').hover(
70 id = $(this).attr('id');
71 $('#edit-' + id).addClass('icon');
72 $('#edit-' + id).removeClass('iconspacer'); },
75 id = $(this).attr('id');
76 $('#edit-' + id).removeClass('icon');
77 $('#edit-' + id).addClass('iconspacer'); }
80 $('.savedsearchdrop').hover(
82 $(this).addClass('drop');
83 $(this).addClass('icon');
84 $(this).removeClass('iconspacer'); },
87 $(this).removeClass('drop');
88 $(this).removeClass('icon');
89 $(this).addClass('iconspacer'); }
92 $('.savedsearchterm').hover(
94 id = $(this).attr('id');
95 $('#drop-' + id).addClass('icon');
96 $('#drop-' + id).addClass('drophide');
97 $('#drop-' + id).removeClass('iconspacer'); },
100 id = $(this).attr('id');
101 $('#drop-' + id).removeClass('icon');
102 $('#drop-' + id).removeClass('drophide');
103 $('#drop-' + id).addClass('iconspacer'); }
106 // click outside notifications menu closes it
107 $('html').click(function() {
108 $('#nav-notifications-linkmenu').removeClass('selected');
109 $('#nav-notifications-menu').css({display: 'none'});
112 $('#nav-notifications-linkmenu').click(function(event) {
113 event.stopPropagation();
115 // click outside profiles menu closes it
116 $('html').click(function() {
117 $('#profiles-menu-trigger').removeClass('selected');
118 $('#profiles-menu').css({display: 'none'});
121 $('#profiles-menu').click(function(event) {
122 event.stopPropagation();
125 // main function in toolbar functioning
126 function toggleToolbar() {
127 if ( $('#nav-floater').is(':visible') ) {
128 $('#nav-floater').slideUp('fast');
129 $('.floaterflip').css({
130 backgroundPosition: '-210px -60px'
132 $('.search-box').slideUp('fast');
134 $('#nav-floater').slideDown('fast');
135 $('.floaterflip').css({
136 backgroundPosition: '-190px -60px'
138 $('.search-box').slideDown('fast');
141 // our trigger for the toolbar button
142 $('.floaterflip').click(function() {
147 // (attempt to) change the text colour in a top post
148 $('#profile-jot-text').focusin(function() {
149 $(this).css({color: '#eec'});
152 $('a[href=#top]').click(function() {
153 $('html, body').animate({scrollTop:0}, 'slow');
158 // shadowing effect for floating toolbars
159 $(document).scroll(function(e) {
160 var pageTop = $('html').scrollTop();
162 $('#nav-floater').css({boxShadow: '3px 3px 10px rgba(0, 0, 0, 0.7)'});
163 $('.search-box').css({boxShadow: '3px 3px 10px rgba(0, 0, 0, 0.7)'});
165 $('#nav-floater').css({boxShadow: '0 0 0 0'});
166 $('.search-box').css({boxShadow: '0 0 0 0'});
173 if (!is_null($cssFile)) {
174 $a->page['htmlhead'] .= sprintf('<link rel="stylesheet" type="text/css" href="%s" />', $cssFile);
180 function dispy_community_info() {
181 /** @purpose some sidebar stuff for new users
184 $url = $a->get_baseurl($ssl_state);
185 $aside['$url'] = $url;
187 $tpl = get_markup_template('communityhome.tpl');
188 return $a->page['aside_bottom'] = replace_macros($tpl, $aside);
191 if(! function_exists('_js_in_foot')) {
192 function _js_in_foot() {
193 /** @purpose insert stuff in bottom of page
196 $baseurl = $a->get_baseurl($ssl_state);
197 $bottom['$baseurl'] = $baseurl;
198 $tpl = get_markup_template('bottom.tpl');
200 return $a->page['bottom'] = replace_macros($tpl, $bottom);