This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Asynchronous wrapper around Captain Up, similar to jQuery's DOM ready. Place this | |
| // snippet on every page where you want the HUD to start in minimized state. Place it | |
| // below the Captain Up script embed snippet in your HTML. The code will run immediately | |
| // after Captain Up finished loading. | |
| captain.up(function() { | |
| // Minimizes the HUD, instantly. | |
| captain.hud.minimize({instantly: true}); | |
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Only run the code when Captain Up has loaded on the page | |
| captain.up(function() { | |
| // Track a new 'daily_visit' custom action | |
| captain.action('daily_visit', { | |
| // Pass extra data about the action | |
| entity: { | |
| // The current page name | |
| name: captain.get_page_title() | |
| // The referrer URL | |
| referrer: captain.player_info.referrer |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| http { | |
| upstream node_server { | |
| server 127.0.0.1:2222; | |
| } | |
| server { | |
| listen 443 ssl; | |
| server_name example.com; | |
| ssl on; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| // Signs a user object with your API secret. | |
| // See: https://captainup.com/help/javascript/user-integration | |
| // | |
| // @param secret - {String} Your Captain Up API secret | |
| // @param user - {Associative Array} the user dictionary | |
| // @return {String} the signed user string | |
| function sign_user($secret, $user) { | |
| // Remove all `null`, `undefined`, arrays and objects from the object |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Asynchronous wrapper around Captain Up, code will run once Captain Up has loaded. | |
| captain.up(function() { | |
| // Periodically test if the user has read the page | |
| setInterval(function(){ | |
| // You need to implement `user_read_the_page` by yourself, maybe as a check | |
| // that the user scrolled to the bottom? Or spent at least a minute on the page? | |
| if (user_read_the_page()) { | |
| // Track the action with Captain Up, remember to configure the action settings for it | |
| // by creating a new 'read' action in your admin panel. | |
| captain.action('read', { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # The CoffeeScriptJSON module is a Sprockets engine that can be used to write | |
| # JSON files in CoffeeScript. | |
| # | |
| # This CoffeeScript: | |
| # | |
| # # whatever.json.coffee_json | |
| # hello: 'world!' | |
| # | |
| # Will be compiled down to: | |
| # |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Asynchronous wrapper to ensure Captain Up has loaded | |
| captain.up(function() { | |
| //open the sign up modal | |
| captain.open_sign_up_modal(); | |
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Asynchronous wrapper, the code will only run after Captain Up has loaded | |
| captain.up(function() { | |
| // Maximize the HUD | |
| captain.hud.maximize(); | |
| // Minimize the HUD | |
| captain.hud.minimize(); | |
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Asynchronous wrapper around the function, to make sure Captain | |
| // Up has loaded completely. | |
| captain.up(function() { | |
| // Minimize the HUD | |
| captain.hud.minimize(); | |
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Asynchronous wrapper around the function, to make sure Captain | |
| // Up has loaded completely. | |
| captain.up(function() { | |
| // Set the points string | |
| captain.l.points = "XP"; | |
| // Set the shorthand name | |
| captain.l.shorthand_points = "XP"; | |
| }); |