Skip to content

Instantly share code, notes, and snippets.

View dmolsen's full-sized avatar

Dave Olsen dmolsen

View GitHub Profile
@dmolsen
dmolsen / jQTouch .focus() for Accessibility
Created December 12, 2010 22:14
Provides a simple way to provide focus on the title of the newly loaded "page" in a jQTouch app for accessibility purposes
// thx to dave mulder for the pointer on what needed to be added and the initial test code
$(function(){
// simple function to force focus on title of the newly loaded page
$('#jqt').bind('pageAnimationEnd', function(event, info){
if (info.direction == "in") {
$("div.current div.toolbar h1").focus();
}
});
@dmolsen
dmolsen / Module Example for Content Adapters.php
Created December 15, 2010 18:38
This shows an example implementation of content adapters at the module level.
<?php
/**
* Copyright (c) 2008 Massachusetts Institute of Technology
*
* Licensed under the MIT License
* Redistributions of files must retain the above copyright notice.
*
*/
@dmolsen
dmolsen / info.yml
Created December 15, 2010 18:40
This show an example info.yml implementation. Both used for adapter detection as well as quick set-up process.
---
name: Calendar (Default)
maintainer:
name: Dave Olsen
org: University Relations - Web
edu: West Virginia University
desc: The default calendar that comes with Mobile Web OSP.
version: 1.0
data: true
adapter: google_calendar
@dmolsen
dmolsen / adapter.php
Created December 15, 2010 18:44
This shows an example adapter class for including content in the calendar module from Google Calendar. I've ripped out most of the generic functions just because it's long.
<?php
/**
* Copyright (c) 2010 West Virginia University
*
* Licensed under the MIT License
* Redistributions of files must retain the above copyright notice.
*
*/
@dmolsen
dmolsen / index.php
Created December 28, 2010 20:33
The main file for the federated search feature
<?php
/**
* Copyright (c) 2010 West Virginia University
*
* Licensed under the MIT License
* Redistributions of files must retain the above copyright notice.
*
*/
@dmolsen
dmolsen / federated.php
Created December 28, 2010 20:35
the federated search script for the map module
<?php
/**
* Copyright (c) 2010 West Virginia University
*
* Licensed under the MIT License
* Redistributions of files must retain the above copyright notice.
*
*/
@dmolsen
dmolsen / federated.html.php
Created December 28, 2010 20:36
The map module federated template that adds the appropriate HTML to $html to be used in the final template
<?
// a template for web/search/ feature hence why it's totally different than all others
$html .= "<div class='nonfocal'><strong>Campus Map Results</strong></div>";
$html .= "<p class='focal results'>";
if ($total == 0) {
$html .= "No results returned.";
} else {
@dmolsen
dmolsen / ga.php
Created January 6, 2011 20:46
A fix to the sendRequestToGoogleAnalytics() function from ga.php to support cURL
<?
function sendRequestToGoogleAnalytics($utmUrl) {
$ch = curl_init();
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_USERAGENT, $_SERVER["HTTP_USER_AGENT"]);
curl_setopt($ch, CURLOPT_HTTPHEADER, array("Accepts-Language: " . $_SERVER["HTTP_ACCEPT_LANGUAGE"]));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); //Set curl to return the data instead of printing it to the browser.
curl_setopt($ch, CURLOPT_URL, $utmUrl);
@dmolsen
dmolsen / gist:1282062
Created October 12, 2011 18:15
simple test of an ajax success function
$.ajax({
url: "test.html",
dataType: 'xml',
success: function (data) {
$('#cancelPayment',data).attr('bar','element');
var str = (new XMLSerializer()).serializeToString(data);
$('#appDiv').html(str).trigger('create');
}
});
@dmolsen
dmolsen / gist:1494961
Created December 19, 2011 00:42
Initializing the YouTubePlayer object to listen to onStateChange events
var vidId = 'videoEmbed'; // the ID of the div holding the video
var vidYTId = 'XhLrlhFzAjA'; // the ID of the video from YouTube
var YTVideo = new YoutubePlayer(vidId, vidYTId,{
width: 640,
height: 360,
objparams: { allowFullscreen: "true" },
ytparams: { rel: 0, showsearch: 0, showinfo: 0, modestbranding: 1 }
});