Fork me on GitHub
Please upgrade to 2.1.x here. The 2.0 branch is no longer being updated.
You should grab 2.1.9, released 18 March. It's what all the cool kids are doing.

Adding Javascript and Getting HelloBar to Work

leogopalleogopal New
edited May 2012 in Vanilla 2.0 Help

Hi guys -

I just purchased hello bar solo -
And am trying to get it to work on my forum -
www.hypnosisforum.co.za

But I can not for the life of me figure out how to get it to work -
I am using the bootstrap theme - http://vanillaforums.org/addon/bootstrap-theme

this is how hello bar asks to be installed >
Step 1 -

[link type="text/css" rel="stylesheet" href="hellobar-solo/hellobar.css" /]
[script type="text/javascript" src="hellobar-solo/hellobar.js"][/script]

[/head]

Step 2

script type="text/javascript"
new HelloBar( "Enter your Hello Bar's message here", {
showWait: 1000
}, 1.0 );
script

[/body]

And finally setting up the specific bar -

No clue where to put the latter code or get any of this working well on my site -

Please Help!

Answers

  • 422422 Developer MVP

    Default.master.php or use pockets plugin.

    422 Real Estate Australia , now open Check it out

  • I tried that - in the default.master.tpl file - and when I add it before the end body tag i get a bonk error

  • Don't add javascript text in default master and you will get bonk, try to add it in themehooks

  • 422422 Developer MVP
    edited May 2012

    Not sure why that would be the case..perhaps elaborate.

    To the OP.

    download example addon in addon section. You can deploy it that way.

    http://vanillaforums.org/addon/example-plugin

    422 Real Estate Australia , now open Check it out

  • create a plugin
    
    <?php if (!defined('APPLICATION'))  exit();
    
    
    // Define the plugin:
    $PluginInfo['HelloBar'] = array(
        'Name' => 'HelloBar',
        'Description' => 'HelloBar add-on',
        'Version' => '1.0',
        'RequiredApplications' => FALSE,
        'RequiredTheme' => FALSE,
        'RequiredPlugins' => FALSE,
    
    );
    
    class HelloBarPlugin extends Gdn_Plugin {
    
    
    // change the controller to wherever you want it to appear
    public function Base_Render_Before($Sender) {
            $Sender->AddJsFile('/plugins/HelloBar/js/hellobar.js');
            $Sender->AddJsFile('/plugins/HelloBar/js/hellobar2.js');
            $Sender->AddCssFile('/plugins/HelloBar/design/hellobar.css');
    
    }
    
    
    
    
    
    }
    
    
    
    ---
    
    hellobar2.js
    
    jQuery(document).ready(function($) {
        new HelloBar( "Enter your Hello Bar's message here", {
            showWait: 1000
        }, 1.0 );
    });
    

Sign In or Register to comment.