HireHop is completely customisable, you can even add custom fields, all done using the HireHop JavaScript injection method, in which JavaScript files that you have written are inserted into HireHop pages. If you look at the page source of a HireHop page, you will see <!– PLUGINS –>, it is after here where the JavaScript for your plugins will be inserted.
HireHop has been built from the ground up, developing our own framework that we call NoHTML, amalgamating existing technology and methodology to produce a framework that is easy to use, extendable and enables fast page loading, even on slow internet connections.
Apart from the main part of the page, the main parts of HireHop are dynamically built on the client machine using JavaScript and jQuery widgets, similar to REACT and JSX, but more simple and of course using the familiar jQuery framework. For instance, if you load a Job page and inspect the page (press F12 for the browser’s object inspector), you will see a <div> element at the bottom of the page structured like so:
<div id=”notes_tab”></div>
As you can see the above <div> is just an empty div element. If you click on the ”Notes” tab, suddenly the above element is populated with elements. Looking at your browser’s inspector you will also notice that the only data loaded from the server was some JSON and not the code in the notes tab. The notes tab was built dynamically on the client machine using a jQuery UI Widget called $.custom.notes that is defined in the file /js/notes.js, and that used an ajax call to the server to get the data to populate it.
All the widget files on HireHop are compressed for speed, however to see the expanded source just add a .MAX to the end of the file’s name, for instance /js/notes.MAX.js.
To inject JavaScript into your webpages, if you go to Settings->Company Settings, and in Plugins add the url of your JavaScript file, which should be on an https server. You can add multiple URLs which you can separate with a ”;” (semi-colon).
Extending A Widget
As these are jQuery UI Widgets, you can use a type of Object Orientated programming to overwrite parts of the HireHop widgets. For example, we are going to create a a small plugin that adds the word Hello after the Refresh button on the notes widget.
First create a JavaScript file on your web server and add the following code
$(document).ready(function(){
// Check if the notes widget exists
if(typeof($.custom.notes)!=”undefined”) {
// Redefine notes widget
$.widget(”custom.notes”, $.custom.notes, {
_init_main: function() {
// Call the old _init_main
this._super(arguments);
// Add an hello after the refresh button
$(”<span>”,{ html:” Hello” }).insertAfter(this.btnRefresh);
},
new_function_name: function() { }
});
}
});
The above code is available in a file located at https://s.myhirehop.com/plugins/demo.js.
Explaining the code above line by line:
$(document).ready(function(){
First we wait for the document to be ready and all page elements and JavaScript files to be loaded. In this case this is not necessary as the /js/notes.js file is loaded before the plugin script, however for this example we have left it in for reference.
if(typeof($.custom.notes)!=”undefined”) {
Next we test to see if the notes widget has been defined, if it has we will proceed to overwrite one part of it.
$.widget(”custom.notes”, $.custom.notes, {
Here we are initiating merging of a new JavaScript object containing functions into the notes widget.
_init_main: function() {
By naming a function the same as an existing one, it will be overwritten.
this._super(arguments);
This calls the inherited function, being the function we are overwriting.
$(”<span>”,{ html:” Hello” }).insertAfter(this.btnRefresh);
We then add a simple span element containing the word ”Hello” after the Refresh button. you could also use $(”<span> Hello</span>”).insertAfter(this.btnRefresh);.
new_function_name: function() { }
Finally, this does nothing and is not necessary for what we need to do, it just demonstrates that you can even add your own functions into the widget.
When you reload the HireHop page, you will see the word Hello after the refresh button if you did everything correctly.
Versioning
A huge advantage of using the HireHop NoHTML framework is that all the JavaScript is cached, resulting in fast page loading as the browser uses the JavaScript files in its cache. This can be problematic when you update your plugin, as all the users using it, their browsers won’t download the updated version, and instead use their cached version, that is unless they clear their browser cache.
To overcome this, when adding your JavaScript URLs to the Plugins options, you can use a versioning parameter, for example for https://www.mywebsite.com/plugin.js you would enter it as https://www.mywebsite.com/plugin.js?v=1. After an update you can then change it to read https://www.mywebsite.com/plugin.js?v=2 which will force all browsers to reload the JavaScript file from your server. If you don’t have a server to store the code on, you can always use GIST or Google Open Source.