Пример #1
0
function dispy_init(&$a)
{
    $a->theme_info = array('family' => 'dispy', 'version' => '1.2.2');
    set_template_engine($a, 'smarty3');
    /** @purpose set some theme defaults
     */
    $cssFile = null;
    $colour = get_pconfig(local_user(), "dispy", "colour");
    $baseurl = $a->get_baseurl($ssl_state);
    if ($colour === false) {
        $colour = "light";
    }
    if ($colour == "light") {
        $colour_path = "/light/";
        require_once 'light/theme.php';
    }
    if ($colour == "dark") {
        $colour_path = "/dark/";
        require_once 'dark/theme.php';
    }
    /** @purpose aside on profile page
     */
    if ($a->argv[0] . $a->argv[1] === "profile" . $a->user['nickname']) {
        dispy_community_info();
    }
    $a->page['htmlhead'] .= <<<EOT
\t<script type="text/javascript" src="{$baseurl}/view/theme/dispy/js/modernizr.custom.2.5.3.min.js"></script>
\t<script type="text/javascript">
\t\$(document).ready(function() {
\t\t// Select all links with lightbox class
\t\t\$("a.lightbox").colorbox({maxHeight:"90%"});

    \t\$('.group-edit-icon').hover(
\t\t\tfunction() {
\t\t\t\t\$(this).addClass('icon');
\t\t\t\t\$(this).removeClass('iconspacer'); },

\t\t\tfunction() {
\t\t\t\t\$(this).removeClass('icon');
\t\t\t\t\$(this).addClass('iconspacer'); }
\t\t);

\t\t\$('.sidebar-group-element').hover(
\t\t\tfunction() {
\t\t\t\tid = \$(this).attr('id');
\t\t\t\t\$('#edit-' + id).addClass('icon');
\t\t\t\t\$('#edit-' + id).removeClass('iconspacer'); },

\t\t\tfunction() {
\t\t\t\tid = \$(this).attr('id');
\t\t\t\t\$('#edit-' + id).removeClass('icon');
\t\t\t\t\$('#edit-' + id).addClass('iconspacer'); }
\t\t);

\t\t\$('.savedsearchdrop').hover(
\t\t\tfunction() {
\t\t\t\t\$(this).addClass('drop');
\t\t\t\t\$(this).addClass('icon');
\t\t\t\t\$(this).removeClass('iconspacer'); },

\t\t\tfunction() {
\t\t\t\t\$(this).removeClass('drop');
\t\t\t\t\$(this).removeClass('icon');
\t\t\t\t\$(this).addClass('iconspacer'); }
\t\t);

\t\t\$('.savedsearchterm').hover(
\t\t\tfunction() {
\t\t\t\tid = \$(this).attr('id');
\t\t\t\t\$('#drop-' + id).addClass('icon');
\t\t\t\t\$('#drop-' + id).addClass('drophide');
\t\t\t\t\$('#drop-' + id).removeClass('iconspacer'); },

\t\t\tfunction() {
\t\t\t\tid = \$(this).attr('id');
\t\t\t\t\$('#drop-' + id).removeClass('icon');
\t\t\t\t\$('#drop-' + id).removeClass('drophide');
\t\t\t\t\$('#drop-' + id).addClass('iconspacer'); }
\t\t\t);

\t\t// click outside notifications menu closes it
\t\t\$('html').click(function() {
\t\t\t\$('#nav-notifications-linkmenu').removeClass('selected');
\t\t\t\$('#nav-notifications-menu').css({display: 'none'});
\t\t});

\t\t\$('#nav-notifications-linkmenu').click(function(event) {
\t\t\tevent.stopPropagation();
\t\t});
\t\t// click outside profiles menu closes it
\t\t\$('html').click(function() {
\t\t\t\$('#profiles-menu-trigger').removeClass('selected');
\t\t\t\$('#profiles-menu').css({display: 'none'});
\t\t});

\t\t\$('#profiles-menu').click(function(event) {
\t\t\tevent.stopPropagation();
\t\t});

\t\t// main function in toolbar functioning
\t\tfunction toggleToolbar() {
\t\t\tif ( \$('#nav-floater').is(':visible') ) {
\t\t\t\t\$('#nav-floater').slideUp('fast');
\t\t\t\t\$('.floaterflip').css({
\t\t\t\t\tbackgroundPosition: '-210px -60px' 
\t\t\t\t});
\t\t\t\t\$('.search-box').slideUp('fast');
\t\t\t} else {
\t\t\t\t\$('#nav-floater').slideDown('fast');
\t\t\t\t\$('.floaterflip').css({
\t\t\t\t\tbackgroundPosition: '-190px -60px'
\t\t\t\t});
\t\t\t\t\$('.search-box').slideDown('fast');
\t\t\t}
\t\t};
\t\t// our trigger for the toolbar button
\t\t\$('.floaterflip').click(function() {
\t\t\ttoggleToolbar();
\t\t\treturn false;
\t\t});

\t\t// (attempt to) change the text colour in a top post
\t\t\$('#profile-jot-text').focusin(function() {
\t\t\t\$(this).css({color: '#eec'});
\t\t});

\t\t\$('a[href=#top]').click(function() {
\t\t\t\$('html, body').animate({scrollTop:0}, 'slow');
\t\t\treturn false;
\t\t});

\t});
\t// shadowing effect for floating toolbars
\t\$(document).scroll(function(e) {
\t\tvar pageTop = \$('html').scrollTop();
\t\tif (pageTop) {
\t\t\t\$('#nav-floater').css({boxShadow: '3px 3px 10px rgba(0, 0, 0, 0.7)'});
\t\t\t\$('.search-box').css({boxShadow: '3px 3px 10px rgba(0, 0, 0, 0.7)'});
\t\t} else {
\t\t\t\$('#nav-floater').css({boxShadow: '0 0 0 0'});
\t\t\t\$('.search-box').css({boxShadow: '0 0 0 0'});
\t\t}
\t});
\t</script>
EOT;
    // custom css
    if (!is_null($cssFile)) {
        $a->page['htmlhead'] .= sprintf('<link rel="stylesheet" type="text/css" href="%s" />', $cssFile);
    }
    _js_in_foot();
}
Пример #2
0
function smoothly_init(&$a)
{
    $a->theme_info = array();
    set_template_engine($a, 'smarty3');
    $cssFile = null;
    $ssl_state = null;
    $baseurl = $a->get_baseurl($ssl_state);
    $a->page['htmlhead'] .= <<<EOT

<script>
function insertFormatting(comment,BBcode,id) {
\t
\t\tvar tmpStr = \$("#comment-edit-text-" + id).val();
\t\tif(tmpStr == comment) {
\t\t\ttmpStr = "";
\t\t\t\$("#comment-edit-text-" + id).addClass("comment-edit-text-full");
\t\t\t\$("#comment-edit-text-" + id).removeClass("comment-edit-text-empty");
\t\t\topenMenu("comment-edit-submit-wrapper-" + id);
\t\t\t\$("#comment-edit-text-" + id).val(tmpStr);
\t\t}

\ttextarea = document.getElementById("comment-edit-text-" +id);
\tif (document.selection) {
\t\ttextarea.focus();
\t\tselected = document.selection.createRange();
\t\tif (BBcode == "url"){
\t\t\tselected.text = "["+BBcode+"]" + "http://" +  selected.text + "[/"+BBcode+"]";
\t\t\t} else\t\t\t
\t\tselected.text = "["+BBcode+"]" + selected.text + "[/"+BBcode+"]";
\t} else if (textarea.selectionStart || textarea.selectionStart == "0") {
\t\tvar start = textarea.selectionStart;
\t\tvar end = textarea.selectionEnd;
\t\tif (BBcode == "url"){
\t\t\ttextarea.value = textarea.value.substring(0, start) + "["+BBcode+"]" + "http://" + textarea.value.substring(start, end) + "[/"+BBcode+"]" + textarea.value.substring(end, textarea.value.length);
\t\t\t} else
\t\ttextarea.value = textarea.value.substring(0, start) + "["+BBcode+"]" + textarea.value.substring(start, end) + "[/"+BBcode+"]" + textarea.value.substring(end, textarea.value.length);
\t}
\treturn true;
}

function cmtBbOpen(id) {
\t\$(".comment-edit-bb-" + id).show();
}
function cmtBbClose(comment, id) {
\t\$(".comment-edit-bb-" + id).hide();
}
\$(document).ready(function() {

\$('html').click(function() { \$("#nav-notifications-menu" ).hide(); });

\$('.group-edit-icon').hover(
\tfunction() {
\t\t\$(this).addClass('icon'); \$(this).removeClass('iconspacer');},
\tfunction() {
\t\t\$(this).removeClass('icon'); \$(this).addClass('iconspacer');}
\t);

\$('.sidebar-group-element').hover(
\tfunction() {
\t\tid = \$(this).attr('id');
\t\t\$('#edit-' + id).addClass('icon'); \$('#edit-' + id).removeClass('iconspacer');},

\tfunction() {
\t\tid = \$(this).attr('id');
\t\t\$('#edit-' + id).removeClass('icon');\$('#edit-' + id).addClass('iconspacer');}
\t);


\$('.savedsearchdrop').hover(
\tfunction() {
\t\t\$(this).addClass('drop'); \$(this).addClass('icon'); \$(this).removeClass('iconspacer');},
\tfunction() {
\t\t\$(this).removeClass('drop'); \$(this).removeClass('icon'); \$(this).addClass('iconspacer');}
\t);

\$('.savedsearchterm').hover(
\tfunction() {
\t\tid = \$(this).attr('id');
\t\t\$('#drop-' + id).addClass('icon'); \t\$('#drop-' + id).addClass('drophide'); \$('#drop-' + id).removeClass('iconspacer');},

\tfunction() {
\t\tid = \$(this).attr('id');
\t\t\$('#drop-' + id).removeClass('icon');\$('#drop-' + id).removeClass('drophide'); \$('#drop-' + id).addClass('iconspacer');}
\t);

});

</script>
EOT;
    /** custom css **/
    if (!is_null($cssFile)) {
        $a->page['htmlhead'] .= sprintf('<link rel="stylesheet" type="text/css" href="%s" />', $cssFile);
    }
    _js_in_foot();
}