-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathclient.js
39 lines (33 loc) · 1.1 KB
/
client.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
pipe.once('package.json:render', function render(pagelet) {
'use strict';
var placeholders = $(pagelet.placeholders)
, guides = placeholders.find('.guide');
/**
* Show or hide the different guides when people interact with the JSON blob.
*
* @param {Event} e DOM event.
* @api private
*/
placeholders.on('click mouseover', 'pre a:not(.trigger)', function guide() {
var offset = $(document).scrollTop() - guides.parent().offset().top;
guides.hide();
placeholders.find('#'+ this.href.split('#').pop().replace('.', '\\.'))
.css('top', (offset < 0 ? 0 : offset) +'px')
.show();
});
/**
* Toggle all nodejitsu specific configuration values.
*
* @param {Event} e DOM event.
* @api private
*/
placeholders.on('click', 'a.trigger', function nodejitsu(e) {
var element = $(this)
, action = element.data('action')
, hide = action === 'fadeOut';
element.data('action', hide ? 'fadeIn' : 'fadeOut');
element.find('span').text(hide ? 'Show' : 'Hide');
placeholders.find('.nodejitsu')[action]();
e.preventDefault();
});
});