Skip to content

Instantly share code, notes, and snippets.

<!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 June 9, 2016 01:34
Expand foldable section.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;
});
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 August 12, 2016 17:01
Zendesk JS for foldable sections
// 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 August 29, 2015 14:11
ScreenSteps Help Widget
<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 December 5, 2014 15:15
Add external link to ScreenSteps table of contents
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 September 17, 2014 13:02
Multi language Zendesk search replace
// 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 July 21, 2014 20:38
Zendesk out of office email
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 August 29, 2015 13:56
Javascript to set ScreenSteps alt tags that match step titles to ""
<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 September 19, 2013 12:02
The overrides we use for CSS on our own ScreenSteps site
#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;}