Skip to content

Instantly share code, notes, and snippets.

View index.html
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
<script src="https://code.jquery.com/jquery-3.1.0.js"></script>
<style id="jsbin-css">
.page {
display: none;
@bluemango
bluemango / expand.js
Created Jun 9, 2016
Expand foldable section.js
View expand.js
$(document).ready(function($) {
if (window.location.hash) {
var anchor = window.location.hash;
var el = $(anchor);
var parents = $(el).parents('.nested-article');
$(parents).show();
$(parents).prev().addClass('expanded');
location.hash = null;
location.hash = anchor;
});
View ScreenSteps Remote Authentication
Given these values:
first_name: 'bob'
email: 'bob@mail.com'
timestamp: '1461844665'
token: 'abc123'
The canoncial string should equal: 'bobbob@mail.comabc1231461844665'
The hash should equal: '833896248e2e157e7ea3561afaa38164'
@bluemango
bluemango / screensteps-zendesk.js
Last active Aug 12, 2016
Zendesk JS for foldable sections
View screensteps-zendesk.js
// Begin ScreenSteps
$(document).ready(function() {
$('.screensteps-nested-content').hide();
$('.screensteps-foldable-content-parent').click(function(event) {
event.preventDefault();
var stepId = $(event.target).attr('id').split('screensteps-step-')[1];
if (stepId) {
var contentId = ["nested-step", stepId].join("-");
$(event.target).toggleClass('expanded');
$('.screensteps-active-step').removeClass('screensteps-active-step');
@bluemango
bluemango / gist:639d9e5390cb19b4137c
Last active Aug 29, 2015
ScreenSteps Help Widget
View gist:639d9e5390cb19b4137c
<script type='text/javascript'>
window.__screensteps = {
'account': '{{your_account_name}}',
'site': '{{your_site_id}}',
'title': '',
'promptMessage': 'Enter a search term above to find an answer to your question.',
'searchFieldPrompt': '',
'viewAllUrl': '{{url_to_your_screensteps_site_table_of_contents}}',
'extraHelpLinkText': 'Contact support',
'extraHelpLinkUrl': '{{url_to_support_contact_page}}',
@bluemango
bluemango / gist:1b2b6feb1c8cf20ff0f2
Created Dec 5, 2014
Add external link to ScreenSteps table of contents
View gist:1b2b6feb1c8cf20ff0f2
jQuery(document).ready(function($) {
var link = '<li class="screenstepslive-manual"> <a href="/m/11169">Getting Started</a> </li>';
var list = jQuery('ul.asset-list')[0];
jQuery(list).prepend(link);
});
@bluemango
bluemango / gist:417064405eba81f1326e
Created Sep 17, 2014
Multi language Zendesk search replace
View gist:417064405eba81f1326e
// Adpated from http://pastie.org/5643496#17,19-20,23
// Just add the appropriate strings for the languages you want to support
$j(document).ready(function()
{
//strip whitespaces from Language-selector
function trim11 (str)
{
str = str.replace(/^\s+/, '');
@bluemango
bluemango / gist:b2b17f572aa25bd9be23
Created Jul 21, 2014
Zendesk out of office email
View gist:b2b17f572aa25bd9be23
Subject:
Agent {{ticket.assignee.first_name}}'s Ticket {{ticket.id}} Has Been Updated - can you take a look?
Body:
Hi guys,
{{ticket.assignee.first_name}} is out of the office and one of his tickets has been updated. Can you check it out?
@bluemango
bluemango / gist:9002559
Last active Aug 29, 2015
Javascript to set ScreenSteps alt tags that match step titles to ""
View gist:9002559
<script type="text/javascript" language="Javascript" >
jQuery(document).ready(function($) {
$('.step').each(function(index) {
var title_tag = $(this).find('>h2');
title_tag = title_tag || $(this).find('>h3');
var img = $(this).find('img');
if ($(title_tag).text() == $(img).attr('alt')) {
$(img).attr('alt', '');
}
});
@bluemango
bluemango / Our ScreenSteps Overrides.css
Created Sep 19, 2013
The overrides we use for CSS on our own ScreenSteps site
View Our ScreenSteps Overrides.css
#screensteps-content-wrapper { margin-top: 40px; font-size: 14px;}
#screensteps-content-wrapper li ul,
#screensteps-content-wrapper li ol { margin: 0 1.5em; }
#screensteps-content-wrapper ul { list-style: disc; }
#screensteps-content-wrapper ol { list-style: decimal; }
#screensteps-content-wrapper { line-height:normal;}
#screensteps-content-wrapper a { text-decoration:underline;}
#screensteps-content-wrapper ul li,
#screensteps-content-wrapper ol li { margin-bottom: 10px; }
#screensteps-content-wrapper .asset-list li a { line-height: 19px;}