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.
20 function dispy_init(&$a) {
22 $a->theme_info = array(
26 set_template_engine($a, 'smarty3');
28 /** @purpose set some theme defaults
31 $colour = get_pconfig(local_user(), "dispy", "colour");
32 $baseurl = $a->get_baseurl($ssl_state);
34 if ($colour === false) { $colour = "light"; }
35 if ($colour == "light") {
36 $colour_path = "/light/";
37 require_once ('light/theme.php');
39 if ($colour == "dark") {
40 $colour_path = "/dark/";
41 require_once ('dark/theme.php');
44 /** @purpose aside on profile page
46 if (($a->argv[0] . $a->argv[1]) === ("profile" . $a->user['nickname'])) {
47 dispy_community_info();
50 $a->page['htmlhead'] .= <<<EOT
51 <script type="text/javascript" src="$baseurl/view/theme/dispy/js/modernizr.custom.2.5.3.min.js"></script>
52 <script type="text/javascript">
53 $(document).ready(function() {
54 // Select all links with lightbox class
55 $("a.lightbox").colorbox({maxHeight:"90%"});
57 $('.group-edit-icon').hover(
59 $(this).addClass('icon');
60 $(this).removeClass('iconspacer'); },
63 $(this).removeClass('icon');
64 $(this).addClass('iconspacer'); }
67 $('.sidebar-group-element').hover(
69 id = $(this).attr('id');
70 $('#edit-' + id).addClass('icon');
71 $('#edit-' + id).removeClass('iconspacer'); },
74 id = $(this).attr('id');
75 $('#edit-' + id).removeClass('icon');
76 $('#edit-' + id).addClass('iconspacer'); }
79 $('.savedsearchdrop').hover(
81 $(this).addClass('drop');
82 $(this).addClass('icon');
83 $(this).removeClass('iconspacer'); },
86 $(this).removeClass('drop');
87 $(this).removeClass('icon');
88 $(this).addClass('iconspacer'); }
91 $('.savedsearchterm').hover(
93 id = $(this).attr('id');
94 $('#drop-' + id).addClass('icon');
95 $('#drop-' + id).addClass('drophide');
96 $('#drop-' + id).removeClass('iconspacer'); },
99 id = $(this).attr('id');
100 $('#drop-' + id).removeClass('icon');
101 $('#drop-' + id).removeClass('drophide');
102 $('#drop-' + id).addClass('iconspacer'); }
105 // click outside notifications menu closes it
106 $('html').click(function() {
107 $('#nav-notifications-linkmenu').removeClass('selected');
108 $('#nav-notifications-menu').css({display: 'none'});
111 $('#nav-notifications-linkmenu').click(function(event) {
112 event.stopPropagation();
114 // click outside profiles menu closes it
115 $('html').click(function() {
116 $('#profiles-menu-trigger').removeClass('selected');
117 $('#profiles-menu').css({display: 'none'});
120 $('#profiles-menu').click(function(event) {
121 event.stopPropagation();
124 // main function in toolbar functioning
125 function toggleToolbar() {
126 if ( $('#nav-floater').is(':visible') ) {
127 $('#nav-floater').slideUp('fast');
128 $('.floaterflip').css({
129 backgroundPosition: '-210px -60px'
131 $('.search-box').slideUp('fast');
133 $('#nav-floater').slideDown('fast');
134 $('.floaterflip').css({
135 backgroundPosition: '-190px -60px'
137 $('.search-box').slideDown('fast');
140 // our trigger for the toolbar button
141 $('.floaterflip').click(function() {
146 // (attempt to) change the text colour in a top post
147 $('#profile-jot-text').focusin(function() {
148 $(this).css({color: '#eec'});
151 $('a[href=#top]').click(function() {
152 $('html, body').animate({scrollTop:0}, 'slow');
157 // shadowing effect for floating toolbars
158 $(document).scroll(function(e) {
159 var pageTop = $('html').scrollTop();
161 $('#nav-floater').css({boxShadow: '3px 3px 10px rgba(0, 0, 0, 0.7)'});
162 $('.search-box').css({boxShadow: '3px 3px 10px rgba(0, 0, 0, 0.7)'});
164 $('#nav-floater').css({boxShadow: '0 0 0 0'});
165 $('.search-box').css({boxShadow: '0 0 0 0'});
172 if (!is_null($cssFile)) {
173 $a->page['htmlhead'] .= sprintf('<link rel="stylesheet" type="text/css" href="%s" />', $cssFile);
179 function dispy_community_info() {
180 /** @purpose some sidebar stuff for new users
183 $url = $a->get_baseurl($ssl_state);
184 $aside['$url'] = $url;
186 $tpl = get_markup_template('communityhome.tpl');
187 return $a->page['aside_bottom'] = replace_macros($tpl, $aside);
190 if(! function_exists('_js_in_foot')) {
191 function _js_in_foot() {
192 /** @purpose insert stuff in bottom of page
195 $baseurl = $a->get_baseurl($ssl_state);
196 $bottom['$baseurl'] = $baseurl;
197 $tpl = get_markup_template('bottom.tpl');
199 return $a->page['bottom'] = replace_macros($tpl, $bottom);