Skip to content

Instantly share code, notes, and snippets.

View thetrickster's full-sized avatar

Chris Matthias thetrickster

View GitHub Profile
@thetrickster
thetrickster / gist:5470271
Last active December 16, 2015 17:29
On facebook Like button event, enable form.fb-like-form input elements
// Setup a variable to contain all the form input elements to enable
var myDisabledFields = "input, textarea, select, button";
// The FB.Event.subscribe method lets us run some javascript on certain events. The "Like" event for the Javascript SDK is "edge.create"
FB.Event.subscribe('edge.create',
// Once we're subscribed, anytime the Like button is cliked Facebook sends us back some data in an array.
// We'll call that data array "response".
function(response) {
// If you uncomment the next line, you'll see the data returned in your console
@thetrickster
thetrickster / gist:5493542
Last active November 10, 2017 04:52
Enable/Disable form fields based on Facebook Like Button events. Press Like and form fields are disabled
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8"/>
</head>
<body>
<div id="fb-root"></div>
<script>
window.fbAsyncInit = function() {
// init the FB JS SDK
@thetrickster
thetrickster / random-web-app-items.html
Last active December 18, 2015 03:29
Business Catalyst Multiple Random Web App Items - Add this code to your page where you want the random items to appear.
<!--
The element where your web app items will be appended to.
By default the script looks for an id of "random-web-app-items"
IMPORTANT: jQuery must be loaded on the page either in the HEAD of the doc or before you call the SCRIPTS below.
-->
<div id="random-web-app-items"></div>
<!-- Download this script to your site and replace the SRC with the path to your site's javascript file -->
<script src="//gist.github.com/thetrickster/5718857/raw/f0d736a4f80248c9c1a4184dcc43e223ac1e1d03/random-web-app-items.js"></script>
@thetrickster
thetrickster / random-web-app-items.tpl
Last active December 18, 2015 03:29
Business Catalyst Multiple Random Web App Items - Custom Module Template See comments below.
webAppItems.push({id: {tag_itemid}, name: "{tag_name_nolink}", url: "{tag_itemurl_nolink}", image: "{tag_image_value}"});
@thetrickster
thetrickster / random-web-app-items.js
Last active December 18, 2015 03:29
BC Multiple Random Web App Items Script
Array.prototype.shuffle = function() {
var i = this.length, j, temp;
if ( i == 0 ) return this;
while ( --i ) {
j = Math.floor( Math.random() * ( i + 1 ) );
temp = this[i];
this[i] = this[j];
this[j] = temp;
}
return this;
@thetrickster
thetrickster / google-maps-v3.html
Created June 6, 2013 21:25
Asynchronous Google Maps v3
<!DOCTYPE html>
<html>
<head>
<title>Asynchronous Loading</title>
<meta name="viewport" content="initial-scale=1.0, user-scalable=no">
<meta charset="utf-8">
<link href="/maps/documentation/javascript/examples/default.css" rel="stylesheet">
<script>
function initialize() {
var mapOptions = {
@thetrickster
thetrickster / bc-workarounds-forum-list.md
Last active December 19, 2015 06:48
Links to important and hard-to-find BC workarounds on the help forums
@thetrickster
thetrickster / yahoo-webplayer-beta.js
Created July 3, 2013 02:56
Yahoo! Webplayer beta script for hosting on your own domain since Yahoo! removed the webplayer docs and scripts from their servers on June 1st, 2013
/* Yahoo! WebPlayer Loader, Build 0.9.76. Copyright (c) 2013, Yahoo! Inc. All rights reserved.
* Your use of this Yahoo! WebPlayer is subject to the Yahoo! Terms of Service
* located at http://info.yahoo.com/legal/us/yahoo/webplayer/details.html
*/
(function(){var d="http://yui.yahooapis.com/3.5.1/build/yui/yui-min.js";if(typeof YAHOO=="undefined"){YAHOO={};}if(typeof YAHOO.MediaPlayer=="undefined"){YAHOO.MediaPlayer=function(){this.controller=null;};}YAHOO.MediaPlayer.isAPIReady=false;YAHOO.MediaPlayer.onAPIReady={subscribers:[],fire:function(){for(var f=0;f<this.subscribers.length;f++){if(YAHOO.MediaPlayer.isAPIReady===true){try{this.subscribers[f]();}catch(g){}}}},subscribe:function(e){this.subscribers.push(e);}};YAHOO.WebPlayer=YAHOO.MediaPlayer;var c=false;function b(f,h){var e=document.createElement("script");e.setAttribute("type","text/javascript");e.setAttribute("src",f);var g=document.getElementsByTagName("head")[0];e.onload=e.onreadystatechange=function(){if(!e.readyState||/loaded|complete/.tes
@thetrickster
thetrickster / bc-disable-country-redirect.js
Created July 8, 2013 01:21
Disable visitors of a certain country or countries access to your site by redirecting them to another page in Business Catalyst
var userCountryCode = "{module_visitorcountrycode}";
var disallowedCountryCodes = ["US", "UK"];
var redirectBlockedUsersURL = "/country-blocked.html";
(function($) {
$.each(disallowedCountryCodes, function(i,val) {
if ( val == userCountryCode ) {
window.location = redirectBlockedUsersURL;
}
});
@thetrickster
thetrickster / README.md
Last active December 19, 2015 20:49
Find and replace Gyrotonic trademark text in a website using jQuery

Gyrotonic® Trademark jQuery Plugin

Beta Version - Still a work in progress. Use at own risk.

Find and replace text node instances of Gyrotonic/Gyrokinesis in a web page and replace with the correct brand styles required by Gyrotonic Sales Group.

  • Download the script below and save it to your website
  • Reference the script in the or of your website after jQuery is already loaded

``