Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Update ignore file.

  • Loading branch information...
commit 12b96c646731b2102217d637a2ac1d5a26d3d358 0 parents
@yllus authored
2  .gitignore
@@ -0,0 +1,2 @@
+.project
+js/key.js
17 .project
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>lemma</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>com.aptana.ide.core.unifiedBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>com.aptana.projects.webnature</nature>
+ </natures>
+</projectDescription>
7 blackberry-tablet.xml
@@ -0,0 +1,7 @@
+<qnx>
+ <author>The Pumping Lemma Company</author>
+ <authorId>gYAAgB9lafGRafX-8boz9PItVf8</authorId>
+ <category>core.social</category>
+ <buildId>1</buildId>
+ <platformVersion>0.1.0.0</platformVersion>
+</qnx>
954 chui/chocolatechip.js
@@ -0,0 +1,954 @@
+/*
+ pO\
+ 6 /\
+ /OO\
+ /OOOO\
+ /OOOOOOOO\
+ ((OOOOOOOO))
+ \:~=++=~:/
+
+ChocolateChip.js: It's tiny but delicious
+A JavaScript library for mobile Web app development.
+
+Copyright 2011 Robert Biggs: www.choclatechip-ui.com
+License: BSD
+Version 1.1.6
+
+*/
+
+(function() {
+ var $ = function ( selector, context ) {
+ if (!!context) {
+ if (typeof context === "string") {
+ return document.querySelector(context + " " + selector);
+ } else if (context.nodeType === 1) {
+ return context.querySelector(selector);
+ }
+ } else {
+ if (typeof selector === "function") {
+ $.ready(function() {
+ selector.call(selector);
+ });
+ } else {
+ return document.querySelector(selector);
+ }
+ }
+ };
+
+ $.extend = function(obj, prop) {
+ if (!Object.keys) {
+ if (!prop) {
+ prop = obj;
+ obj = this;
+ }
+ for (var i in prop) {
+ obj[i] = prop[i];
+ }
+ return obj;
+ } else {
+ Object.keys(prop).forEach(function(p) {
+ if (prop.hasOwnProperty(p)) {
+ Object.defineProperty(obj, p, {
+ value: prop[p],
+ writable: true,
+ enumerable: false,
+ configurable: true
+ });
+ }
+ });
+ }
+ };
+
+ $.extend($, {
+
+ version : "1.1.6",
+
+ collectionToArray : function ( collection ) {
+ var array = [];
+ var i = 0, len = collection.length;
+ while ( i < len ) {
+ array[i] = collection[i];
+ i++;
+ }
+ return array;
+ },
+
+ $$ : function ( selector, context ) {
+ if (!!context) {
+ if (typeof context === "string") {
+ return $.collectionToArray(document.querySelectorAll(context + " " + selector));
+ } else if (context.nodeType === 1){
+ return $.collectionToArray(context.querySelectorAll(selector));
+ }
+ } else {
+ return $.collectionToArray(document.querySelectorAll(selector));
+ }
+ },
+
+ make : function ( HTMLString ) {
+ var nodes = [];
+ var temp = document.createElement("div");
+ temp.innerHTML = HTMLString;
+ var i = 0;
+ var len = temp.childNodes.length;
+ while (i < len) {
+ nodes[i] = temp.childNodes[i];
+ i++;
+ }
+ return nodes;
+ },
+
+ replace : function ( newElem, oldElem ) {
+ oldElem.parentNode.replaceChild(newElem, oldElem);
+ },
+
+ processJSON : function ( data ) {
+ var script = document.createElement("script");
+ script.setAttribute("type", "text/javascript");
+ var scriptID = $.UIUuid();
+ script.setAttribute("id", scriptID);
+ script.insert(data);
+ $("head").insert(script, "last");
+ $.defer(function() {
+ var id = "#" + scriptID;
+ $(id).remove();
+ });
+ }
+ });
+ $.extend(HTMLElement.prototype, {
+
+ previous : function ( ) {
+ return this.previousElementSibling;
+ },
+
+ next : function ( ) {
+ return this.nextElementSibling;
+ },
+
+ first : function ( ) {
+ return this.firstElementChild;
+ },
+
+ last : function ( ) {
+ return this.lastElementChild;
+ },
+
+ ancestor : function( selector ) {
+ var idCheck = new RegExp("^#");
+ var classCheck = new RegExp("^.");
+ var position = null;
+ var newSelector = null;
+ var p = this.parentNode;
+ if (!p) {
+ return false;
+ }
+ if (typeof selector === "string") {
+ selector.trim();
+ }
+ if (typeof selector === "number") {
+ position = selector || 1;
+ for (var i = 1; i < position; i++) {
+ if (p.nodeName === "HTML") {
+ return p;
+ } else {
+ if (p != null) {
+ p = p.parentNode;
+ }
+ }
+ }
+ return p;
+ } else if (selector.substr(0,1) === "." ) {
+ newSelector = selector.split(".")[1];
+ if (p.nodeName === "BODY") {
+ return false;
+ }
+ if (p.hasClass(newSelector)) {
+ return p;
+ } else {
+ return p.ancestor(selector);
+ }
+ } else if (selector.substr(0,1) === "#" ) {
+ newSelector = selector.split("#")[1];
+ if (p.getAttribute("id") === newSelector) {
+ return p;
+ } else {
+ return p.ancestor(selector);
+ }
+ } else {
+ if (p.tagName.toLowerCase() === selector) {
+ return p;
+ } else {
+ return p.ancestor(selector);
+ }
+ }
+ },
+
+ ancestorByTag : function ( selector ) {
+ return this.ancestor(selector);
+ },
+
+ ancestorByClass : function ( selector ) {
+ selector = "." + selector;
+ return this.ancestor(selector);
+ },
+
+ ancestorByPosition : function ( position ) {
+ return this.ancestor(position);
+ },
+
+ clone : function ( value ) {
+ if (value === true || !value) {
+ return this.cloneNode(true);
+ } else {
+ return this.cloneNode(false);
+ }
+ },
+
+ wrap : function ( string ) {
+ var tempNode = $.make(string);
+ tempNode = tempNode[0];
+ var whichClone = this.clone(true);
+ tempNode.appendChild(whichClone);
+ this.after(tempNode, this);
+ this.remove(this);
+ return this;
+ },
+
+ unwrap : function ( ) {
+ if (this.parentNode.nodeName === "BODY") {
+ return false;
+ }
+ var element = this.cloneNode(true);
+ $.replace(element, this.parentNode);
+ return this;
+ },
+
+ text : function ( value ) {
+ if (!!value) {
+ this.innerText = value;
+ } else {
+ return this.innerText;
+ }
+ },
+
+ fill : function ( content ) {
+ this.empty();
+ if (typeof content === "string") {
+ this.textContent = content;
+ } else {
+ this.insert(content);
+ }
+ return this;
+ },
+
+ empty : function ( ) {
+ this.removeEvents();
+ this.textContent = "";
+ return this;
+ },
+
+ remove : function ( ) {
+ this.removeEvents();
+ this.parentNode.removeChild(this);
+ },
+
+ insert : function ( content, position ) {
+ var c = "";
+ if (typeof content === "string") {
+ c = $.make(content);
+ } else if (content.nodeType === 1) {
+ c = [];
+ c.push(content);
+ } else {
+ c = content;
+ }
+ var i = 0;
+ var len = c.length;
+ if (!position || position > (this.children.length + 1) || position === "last") {
+ while (i < len) {
+ this.appendChild(c[i]);
+ i++;
+ }
+ } else if (position === 1 || position === "first") {
+ while (i < len) {
+ this.insertBefore(c[i], this.firstElementChild);
+ i++;
+ }
+ } else {
+ while (i < len) {
+ this.insertBefore(c[i], this.children[position - 1]);
+ i++;
+ }
+ }
+ return this;
+ },
+
+ before : function ( content ) {
+ if (content.constructor === Array) {
+ var len = content.length;
+ var i = 0;
+ while (i < len) {
+ this.parentNode.insertBefore(content[i], this);
+ i++;
+ }
+ } else {
+ this.parentNode.insertBefore(content, this);
+ }
+ return this;
+ },
+
+ after : function ( content ) {
+ var parent = this.parentNode;
+ if (content.constructor === Array) {
+ var i = 0, len = content.length;
+ while (i < len) {
+ if (this === parent.lastChild) {
+ parent.appendChild(content[i]);
+ } else {
+ parent.insertBefore(content[i],this.nextSibling);
+ }
+ i++;
+ }
+ } else {
+ if (content === this.lastChild) {
+ parent.appendChild(content);
+ } else {
+ parent.insertBefore(content, this.next());
+ }
+ }
+ return this;
+ },
+
+ hasClass : function ( className ) {
+ return new RegExp('(?:^|\\s+)' + className + '(?:\\s+|$)').test(this.className);
+ },
+
+ addClass : function ( className ) {
+ if (!this.hasClass(className)) {
+ this.className = [this.className, className].join(' ').replace(/^\s*|\s*$/g, "");
+ return this;
+ }
+ },
+
+ removeClass : function ( className ) {
+ if (this.hasClass(className)) {
+ var currentClasses = this.className;
+ this.className = currentClasses.replace(new RegExp('(?:^|\\s+)' + className + '(?:\\s+|$)', 'g'), ' ').replace(/^\s*|\s*$/g, "");
+ return this;
+ }
+ },
+
+ disable : function ( ) {
+ this.addClass("disabled");
+ this.css("{cursor: default;}");
+ this.preventDefault();
+ return this;
+ },
+
+ enable : function ( ) {
+ this.removeClass("disabled");
+ this.css("{cursor: pointer;}");
+ return this;
+ },
+
+ toggleClass : function ( firstClassName, secondClassName ) {
+ if (!secondClassName) {
+ if (!this.hasClass(firstClassName)) {
+ this.addClass(firstClassName);
+ } else {
+ this.removeClass(firstClassName);
+ }
+ } else if (secondClassName) {
+ if (!this.hasClass(firstClassName)) {
+ this.addClass(firstClassName);
+ this.removeClass(secondClassName);
+ } else {
+ this.removeClass(firstClassName);
+ this.addClass(secondClassName);
+ }
+ }
+ return this;
+ },
+
+ getTop : function() {
+ var element = this;
+ var pos = 0;
+ while (element.offsetParent) {
+ pos += element.offsetTop;
+ element = element.offsetParent;
+ }
+ pos = pos + document.body.offsetTop;
+ return pos;
+ },
+
+ getLeft : function(element) {
+ var element = this;
+ var pos = 0;
+ while (element.offsetParent) {
+ pos += element.offsetLeft;
+ element = element.offsetParent;
+ }
+ pos = pos + document.body.offsetLeft;
+ return pos;
+ },
+
+ css : function ( property, value ) {
+ if (/\{/.test(property) && /\}/.test(property) && !value) {
+ this.style.cssText += property.substring(1, property.length - 1);
+ }
+ if (!value) {
+ return document.defaultView.getComputedStyle(this, null).getPropertyValue(property.toLowerCase());
+ } else {
+ this.style.cssText += property + ":" + value + ";";
+ return this;
+ }
+ },
+ bind : function( event, callback ) {
+ this.addEventListener(event, callback, false);
+ },
+
+ unbind : function( event, callback ) {
+ this.removeEventListener( event, callback, false );
+ },
+
+ removeEvents : function ( ) {
+ var i = 0, len = $.events.length;
+ while (i < len) {
+ this[$.events[i]] = null;
+ i++;
+ }
+ },
+
+ delegate : function ( selector, event, callback ) {
+ this.addEventListener(event, function(e) {
+ var target = e.target;
+ $.$$(selector, this).forEach(function(element) {
+ if (element.isSameNode(target)) {
+ callback.apply(this, arguments);
+ } else {
+ try {
+ var ancestor = target.ancestor(selector);
+ if (element.isSameNode(ancestor)) {
+ e.stopPropagation();
+ callback.call(this, ancestor);
+ }
+ } catch(e) {}
+ }
+ });
+ }, false);
+ },
+
+ trigger : function ( event ) {
+ if( document.createEvent ) {
+ var evtObj = document.createEvent('Events');
+ evtObj.initEvent(event, true, false);
+ this.dispatchEvent(evtObj);
+ }
+ },
+
+ anim : function ( options, duration, easing ) {
+ var onEnd = null;
+ var value = "-webkit-transition: all " + (duration + " " || ".5s ") + easing + ";" || "" + ";";
+ for (var prop in options) {
+ if (prop === "onEnd") {
+ onEnd = options[prop];
+ this.bind("webkitTransitionEnd", function() {
+ onEnd();
+ });
+ } else {
+ value += prop + ":" + options[prop] + ";";
+ }
+ }
+ this.css("{" + value + "}");
+ },
+ xhr : function ( url, options ) {
+ var o = options ? options : {};
+ var successCallback = null;
+ var errorCallback = null;
+ if (!!options) {
+ if (!!options.successCallback || !!options.success) {
+ successCallback = options.successCallback || options.success;
+ }
+ }
+ var that = this,
+ request = new XMLHttpRequest(),
+ method = o.method || 'get',
+ async = o.async || false,
+ params = o.data || null,
+ i = 0;
+ request.queryString = params;
+ request.open(method, url, async);
+ if (o.headers) {
+ for (; i<o.headers.length; i++) {
+ request.setRequestHeader(o.headers[i].name, o.headers[i].value);
+ }
+ }
+ request.handleResp = (successCallback != null) ? successCallback : function() {
+ that.insert(this.responseText);
+ };
+ function hdl(){
+ if(request.status===0 || request.status==200 && request.readyState==4) {
+ $.responseText = request.responseText;
+ request.handleResp();
+ } else {
+ if (!!options.errorCallback || !!options.error) {
+ var errorCallback = options.errorCallback || options.error;
+ errorCallback();
+ }
+ }
+ }
+ if(async) request.onreadystatechange = hdl;
+ request.send(params);
+ if(!async) hdl();
+ return this;
+ },
+
+ xhrjson : function ( url, options ) {
+ if (options === "undefined") {
+ return this;
+ }
+ var c = options.callback;
+ if (typeof c != 'function') {
+ c = function (x) {
+ return x;
+ };
+ }
+ var callback = function () {
+ var o = eval('(' + this.responseText + ')');
+ for (var prop in o) {
+ $(options[prop]).fill(c(o[prop]));
+ }
+ };
+ options.successCallback = callback;
+ this.xhr(url, options);
+ return this;
+ },
+
+ data : function ( key, value ) {
+ if (!!document.documentElement.dataset) {
+ var key = key.camelize();
+ if (!value) {
+ if (/{/.test(value)) {
+ return JSON.parse(this.dataset[key]);
+ } else {
+ return this.dataset[key];
+ }
+ } else {
+ if (typeof value === "object") {
+ this.dataset[key] = JSON.stringify(value);
+ } else {
+ this.dataset[key] = value;
+ }
+ }
+ // Fallback for earlier versions of Webkit:
+ } else {
+ if (!value) {
+ if (/{/.test(value)) {
+ return JSON.parse(this.getAttribute("data-" + key));
+ } else {
+ return this.getAttribute("data-" + key);
+ }
+ } else {
+ if (typeof value === "object") {
+ this.setAttribute("data-" + key, JSON.stringify(value));
+ } else {
+ this.setAttribute("data-" + key, value);
+ }
+ }
+ }
+ },
+
+ removeData : function ( key ) {
+ if (!!document.documentElement.dataset) {
+ var key = key.camelize();
+ this.dataset[key] = null;
+ // Fallback for earlier versions of Webkit:
+ } else {
+ this.removeAttribute("data-" + key);
+ }
+ },
+
+ UICheckForOverflow : function (){
+ var origOverflow = this.css("overflow");
+ if ( !origOverflow || origOverflow === "visible" ) {
+ this.style.overflow = "hidden";
+ }
+ var overflow = this.clientWidth < this.scrollWidth ||
+ this.clientHeight < this.scrollHeight;
+ this.css("overflow", origOverflow);
+
+ return overflow;
+ }
+ });
+
+ $.extend(String.prototype, {
+
+ capitalize : function ( ) {
+ var str = this;
+ return str.charAt(0).toUpperCase() + str.substring(1).toLowerCase();
+ },
+
+ capitalizeAll : function ( ) {
+ var str = this.split(" ");
+ var newstr = [];
+ str.forEach(function(item) {
+ newstr.push(item.capitalize());
+ });
+ return newstr.join(" ");
+ },
+ camelize : function ( ) {
+ return this.replace(/\-(.)/g, function(m, l){return l.toUpperCase()});
+ },
+ deCamelize : function ( ) {
+ return this.replace(/([A-Z])/g, '-$1').toLowerCase();
+ }
+ });
+
+
+ $.extend($, {
+
+ delay : function ( fnc, time ) {
+ var argv = Array.prototype.slice.call(arguments, 2);
+ return setTimeout(function() {
+ return fnc.apply(fnc, argv);
+ }, time);
+ },
+
+ defer : function ( fnc ) {
+ return $.delay.apply($, [fnc, 1].concat(Array.prototype.slice.call(arguments, 1)));
+ },
+
+ enclose : function(func, enclosure) {
+ return function() {
+ var args = [func].concat(Array.prototype.slice.call(arguments));
+ return enclosure.apply(enclosure, args);
+ };
+ },
+
+ compose : function() {
+ var funcs = Array.prototype.slice.call(arguments);
+ return function() {
+ var args = Array.prototype.slice.call(arguments);
+ for (var i=funcs.length-1; i >= 0; i--) {
+ args = [funcs[i].apply(this, args)];
+ }
+ return args[0];
+ };
+ },
+
+ events : ['onmousedown', 'onmouseup', 'onmouseover', 'onmouseout', 'onclick', 'onmousemove', 'ondblclick', 'onerror', 'onresize', 'onscroll', 'onkeydown', 'onkeyup', 'onkeypress', 'onchange', 'onsubmit', 'onload', 'ontouchstart', 'ontouchmove', 'ontouchend', 'ontouchcancel', 'ongesturestart', 'ongesturechange', 'ongestureend', 'onorientationchange'],
+
+ loadEvent : function ( F ) {
+ var oldonload = window.onload;
+ if (typeof window.onload !== 'function') {
+ window.onload = F;
+ } else {
+ window.onload = function () {
+ oldonload();
+ F();
+ };
+ }
+ },
+
+ DOMReadyList : [],
+
+ executeWhenDOMReady : function ( ) {
+ var listLen = $.DOMReadyList.length;
+ var i = 0;
+ while (i < listLen) {
+ $.DOMReadyList[i]();
+ i++;
+ }
+ $.DOMReadyList = null;
+ document.removeEventListener('DOMContentLoaded', $.executeWhenDOMReady, false);
+ },
+
+ ready : function ( callback ) {
+ if ($.DOMReadyList.length === 0) {
+ document.addEventListener('DOMContentLoaded', $.executeWhenDOMReady, false);
+ }
+
+ $.DOMReadyList.push(callback);
+ },
+
+ UIHideURLbar : function() {
+ window.scrollTo(0, 1);
+ },
+
+ importScript : function ( url ) {
+ var script = document.createElement("script");
+ script.setAttribute("type", "text/javascript");
+ script.setAttribute("src", url);
+ $("head").appendChild(script);
+ },
+
+ iphone : /iphone/i.test(navigator.userAgent),
+ ipad : /ipad/i.test(navigator.userAgent),
+ ipod : /ipod/i.test(navigator.userAgent),
+ ios : /ip(hone|od|ad)/i.test(navigator.userAgent),
+ android : /android/i.test(navigator.userAgent),
+ webos : /webos/i.test(navigator.userAgent),
+ blackberry : /blackberry/i.test(navigator.userAgent),
+ touchEnabled : ("createTouch" in document),
+ online : navigator.onLine,
+ standalone : navigator.standalone,
+
+ localItem : function ( key, value ) {
+ try {
+ if (!value) {
+ try {
+ var value = localStorage.getItem(key);
+ if (value[0] === "{") {
+ value = JSON.parse(value);
+ }
+ return value;
+ } catch(e) {}
+ }
+ if (typeof value === "object") {
+ value = JSON.stringify(value);
+ }
+ localStorage.setItem(key, value);
+ } catch(e) {
+ if (e === "QUOTA_EXCEEDED_ERR") {
+ console.error('Quota exceeded for localStorage!');
+ }
+ }
+ },
+ deleteLocalItem : function ( key ) {
+ try {
+ localStorage.removeItem(key);
+ } catch(e) {}
+ },
+ clearLocalItems : function ( ) {
+ localStorage.clear();
+ },
+
+ templates : {},
+
+ template : function(str, data) {
+ if ($.ajaxStatus === null || $.ajaxStatus === false) {
+ return data;
+ }
+ if ($.templates[str]) {
+ var str = $.templates[str];
+ } else {
+ var str = str;
+ }
+ var tmpl = 'var p=[],print=function(){p.push.apply(p,arguments);};with(obj||{}){p.push(\'';
+ var regex1;
+ var regex2;
+ if (/{{/.test(str) || /${/.test(str)) {
+ regex1 = /\$\{([\s\S]+?)\}/g;
+ regex2 = /\{\{([\s\S]+?)\}\}/g;
+ } else if (/\[\[/.test(str) || /$\[/.test(str)) {
+ regex1 = /\$\[([\s\S]+?)\]/g;
+ regex2 = /\[\[([\s\S]+?)\]\]/g;
+ } else if (/<%/.test(str) || /<%=/.test(str)) {
+ regex1 = /<%=([\s\S]+?)%>/g;
+ regex2 = /<%([\s\S]+?)%>/g;
+ }
+ tmpl +=
+ str.replace(/\\/g, '\\\\')
+ .replace(/'/g, "\\'")
+ .replace(regex1, function(match, code) {
+ return "'," + code.replace(/\\'/g, "'") + ",'";
+ })
+ .replace(regex2 || null, function(match, code) {
+ return "');" + code.replace(/\\'/g, "'")
+ .replace(/[\r\n\t]/g, ' ') + "p.push('";
+ })
+ .replace(/\r/g, '\\r')
+ .replace(/\n/g, '\\n')
+ .replace(/\t/g, '\\t')
+ + "');} return p.join('');";
+ var fn = new Function('obj', tmpl);
+ return data ? fn(data) : fn;
+ },
+
+ UIUpdateOrientationChange : function ( ) {
+ var body = $("body");
+ document.addEventListener("orientationchange", function() {
+ if (window.orientation === 0 || window.orientation === 180) {
+ body.removeClass("landscape");
+ body.addClass("portrait");
+ $.UIHideURLbar();
+ } else {
+ body.removeClass("portrait");
+ body.addClass("landscape");
+ $.UIHideURLbar();
+ }
+ $.UIHideURLbar();
+ }, false);
+ },
+
+ UIListenForWindowResize : function ( ) {
+ var body = $("body");
+ window.addEventListener("resize", function() {
+ if (window.innerHeight > window.innerWidth) {
+ body.removeClass("landscape");
+ body.addClass("portrait");
+ $.UIHideURLbar();
+ } else {
+ body.removeClass("portrait");
+ body.addClass("landscape");
+ $.UIHideURLbar();
+ }
+ }, false);
+ },
+ kvo : function () {
+ // Register observers of a key for this object:
+ this.registerObserver = function(observer, key) {
+ if (this.observers == null) {
+ this.observers = {};
+ }
+ if (this.observers[key] == null) {
+ this.observers[key] = [observer];
+ } else {
+ this.observers[key].push(observer);
+ }
+ },
+
+ // Set a value of this object, and inform observers of the assignment:
+ this.set = function(key, value) {
+ if (this.observers != null && this.observers[key] != null) {
+ currentValue = this[key];
+ this.observers[key].forEach(function(observer) {
+ observer.keyWillUpdate(this, key, currentValue, value);
+ });
+ this[key] = value;
+ }
+ }
+ },
+ form2JSON : function(rootNode, delimiter) {
+ rootNode = typeof rootNode == 'string' ? $(rootNode) : rootNode;
+ delimiter = delimiter || '.';
+ var formValues = getFormValues(rootNode);
+ var result = {};
+ var arrays = {};
+
+ formValues.forEach(function(item) {
+ var value = item.value;
+ if (value !== '') {
+ var name = item.name;
+ var nameParts = name.split(delimiter);
+ var currResult = result;
+ for (var j = 0; j < nameParts.length; j++) {
+ var namePart = nameParts[j];
+ var arrName;
+ if (namePart.indexOf('[]') > -1 && j == nameParts.length - 1) {
+ arrName = namePart.substr(0, namePart.indexOf('['));
+ if (!currResult[arrName]) currResult[arrName] = [];
+ currResult[arrName].push(value);
+ } else {
+ if (namePart.indexOf('[') > -1) {
+ arrName = namePart.substr(0, namePart.indexOf('['));
+ var arrIdx = namePart.replace(/^[a-z]+\[|\]$/gi, '');
+ /* Because arrIdx in field name can be not zero-based and step can be other than 1, we can't use them in target array directly. Instead we're making a hash where key is arrIdx and value is a reference to added array element */
+
+ if (!arrays[arrName]) {
+ arrays[arrName] = {};
+ }
+ if (!currResult[arrName]) {
+ currResult[arrName] = [];
+ }
+ if (j == nameParts.length - 1) {
+ currResult[arrName].push(value);
+ } else {
+ if (!arrays[arrName][arrIdx]) {
+ currResult[arrName].push({});
+ arrays[arrName][arrIdx] =
+ currResult[arrName][currResult[arrName].length - 1];
+ }
+ }
+ currResult = arrays[arrName][arrIdx];
+ } else {
+ /* Not the last part of name - means object */
+ if (j < nameParts.length - 1) {
+ if (!currResult[namePart]) {
+ currResult[namePart] = {};
+ }
+ currResult = currResult[namePart];
+ } else {
+ currResult[namePart] = value;
+ }
+ }
+ }
+ }
+ }
+ });
+ return result;
+
+ function getFormValues(rootNode) {
+ var result = [];
+ var currentNode = rootNode.firstChild;
+ while (currentNode) {
+ if (currentNode.nodeName.match(/INPUT|SELECT|TEXTAREA/i)) {
+ result.push({ name: currentNode.name, value: getFieldValue(currentNode)});
+ } else {
+ var subresult = getFormValues(currentNode);
+ result = result.concat(subresult);
+ }
+ currentNode = currentNode.nextSibling;
+ }
+ return result;
+ }
+ function getFieldValue(fieldNode) {
+ if (fieldNode.nodeName == 'INPUT') {
+ if (fieldNode.type.toLowerCase() == 'radio' || fieldNode.type.toLowerCase() == 'checkbox') {
+ if (fieldNode.checked) {
+ return fieldNode.value;
+ }
+ } else {
+ if (!fieldNode.type.toLowerCase().match(/button|reset|submit|image/i)) {
+ return fieldNode.value;
+ }
+ }
+ } else {
+ if (fieldNode.nodeName == 'TEXTAREA') {
+ return fieldNode.value;
+ } else {
+ if (fieldNode.nodeName == 'SELECT') {
+ return getSelectedOptionValue(fieldNode);
+ }
+ }
+ }
+ return '';
+ }
+ function getSelectedOptionValue(selectNode) {
+ var multiple = selectNode.multiple;
+ if (!multiple) {
+ return selectNode.value;
+ }
+ if (selectNode.selectedIndex > -1) {
+ var result = [];
+ $$("option", selectNode).forEach(function(item) {
+ if (item.selected) {
+ result.push(item.value);
+ }
+ });
+ return result;
+ }
+ }
+ }
+ });
+ if (window.$ === undefined) {
+ window.$ = $;
+ window.$$ = $.$$;
+ } else {
+ window.__$ = $;
+ window.__$$ = $.$$;
+ }
+})();
+$.ready(function() {
+ $.UIUpdateOrientationChange();
+ $.UIListenForWindowResize();
+});
+
+if (!Function.prototype.bind) {
+ Function.prototype.bind = function(func, obj) {
+ var args = Array.prototype.slice.call(arguments, 2);
+ return function() {
+ return func.apply(obj || {}, args.concat(Array.prototype.slice.call(arguments)));
+ };
+ };
+}
3,440 chui/chui.css
3,440 additions, 0 deletions not shown
2,540 chui/chui.js
2,540 additions, 0 deletions not shown
14 config.xml
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<widget xmlns="http://www.w3.org/ns/widgets" xmlns:rim="http://www.blackberry.com/ns/widgets" version="1.0.0.16" rim:header="RIM-Widget:rim/widget">
+ <name>Lemma</name>
+ <description>A free, open-source Twitter app for the PlayBook.</description>
+ <author rim:copyright="2011">Sully Syed</author>
+ <icon rim:hover="false" src="icon.png"/>
+ <icon rim:hover="true" src="icon.png"/>
+ <rim:orientation mode="landscape" />
+ <access subdomains="true" uri="*" />
+ <content src="index.html" />
+ <feature id="blackberry.invoke" />
+ <feature id="blackberry.invoke.BrowserArguments" />
+ <feature id="blackberry.identity" />
+</widget>
334 css/lemma.css
@@ -0,0 +1,334 @@
+html, body {
+ font-family: 'DejaVu Sans', Helvetica, Arial, sans-serif;
+}
+
+*[ui-background-style=slanted-right] {
+ background-color: #909090;
+}
+
+tablecell[ui-usage=image] > img {
+ float: left !important;
+ height: 73px;
+ width: 73px;
+}
+
+tableview[ui-tablecell-order=stacked] > tablecell[ui-usage=image] > cellsubtitle {
+ display: inline-block;
+ margin-top: 0;
+ margin-left: 0;
+}
+
+view tableview[ui-tablecell-order="stacked"] > tablecell.ui-no-hover:hover > cellsubtitle {
+ color: #484848 !important;
+}
+
+tableview[ui-tablecell-order=stacked] > tablecell > cellsubtitle {
+ color: #484848 !important;
+}
+
+tablecell > cellsubtitle {
+ color: #484848;
+ position: absolute;
+ right: 10px;
+ margin-top: 4px;
+ white-space: normal;
+ display: inline-block;
+ font-size: 18px;
+ line-height: 24px;
+}
+
+tablecell > celldetail.ui-custom-tint {
+ color: #484848 !important;
+ font-size: 18px;
+ line-height: 24px;
+}
+
+tableview > tablecell.ui-no-hover:hover > celldetail.ui-custom-tint,
+tableview > tablecell.ui-no-hover.touched > celldetail.ui-custom-tint {
+ color: #484848 !important;
+ font-size: 18px;
+ line-height: 24px;
+}
+
+tableview > tablecell.ui-no-hover > *, tableview.ui-no-hover > tablecell > * {
+ color: #484848 !important;
+}
+
+subview > scrollpanel {
+ height: auto;
+ min-height: 100%;
+ overflow: hidden;
+ padding-bottom: 0;
+}
+
+subview[ui-associations=withBottomToolBar] {
+ top: 0px;
+ bottom: 60px;
+}
+
+navbar, toolbar {
+ height: 60px;
+ background-image:
+ -webkit-gradient(linear, left top, left bottom,
+ from(rgba(74,74,74,0.7)),
+ color-stop(0.5, rgba(20,20,20,0.7)),
+ color-stop(0.5, rgba(2,2,2,0.7)),
+ to(rgba(14,14,14,0.7)));
+}
+
+toolbar > segmentedcontrol > uibutton.ui-custom-tint, navbar > uibutton.ui-custom-tint {
+ background-color: #484848;
+ font-family: 'DejaVu Sans', Helvetica, Arial, sans-serif;
+ font-size: 16px;
+ font-style: normal;
+ font-variant: normal;
+ font-weight: normal;
+ height: 45px;
+}
+
+uibutton.ui-custom-tint {
+ background-color: #484848;
+ font-family: 'DejaVu Sans', Helvetica, Arial, sans-serif;
+ font-size: 16px;
+ font-style: normal;
+ font-variant: normal;
+ font-weight: normal;
+ height: 45px;
+}
+
+tableview[ui-tablecell-order=stacked] > tablecell[ui-usage=image] > img ~ cellsubtitle {
+ width: 850px !important;
+}
+
+tablecell > cellsubtitle a {
+ color: #00E;
+}
+
+.fullbuttonheight {
+ margin: 0;
+ width: 65px !important;
+ height: 73px !important;
+ border-left: 1px solid #D9D9D9 !important;
+}
+
+.fullprofileimgheight {
+ width: 73px;
+ height: 73px;
+ border-right: 1px solid #D9D9D9;
+}
+
+tableview#timeline > tablecell.ui-no-hover:hover,
+tableview#timeline > tablecell.ui-no-hover.touched {
+ background-image: none !important;
+ background-color: #EFF9FC !important;
+}
+
+popup {
+ width: 900px;
+ background-color: #000;
+}
+
+popup > panel {
+ background-image: none;
+}
+
+uibutton[ui-kind="action"]:hover,
+uibutton[ui-kind="action"].touched,
+uibutton[ui-kind=action][ui-implements=cancel]:hover,
+uibutton[ui-kind=action][ui-implements=cancel].touched {
+ background-image: -webkit-gradient(
+ linear,
+ left bottom,
+ left top,
+ color-stop(1, rgb(6,168,233)),
+ color-stop(0, rgb(0,113,199))
+ );
+}
+
+uibutton[ui-kind="action"], uibutton[ui-kind="action"].disabled:hover, uibutton[ui-kind="action"].disabled.touched {
+ background-color: #F0F0F0;
+ background-image: -webkit-gradient(linear, 0% 100%, 0% 0%, from(#D1D2D4), to(#FCFCFC));
+ border-bottom-color: rgba(255, 255, 255, 0.496094);
+ border-bottom-left-radius: 5px;
+ border-bottom-right-radius: 5px;
+ border-bottom-style: solid;
+ border-bottom-width: 1px;
+ border-left-color: rgba(255, 255, 255, 0.496094);
+ border-left-style: solid;
+ border-left-width: 1px;
+ border-right-color: rgba(255, 255, 255, 0.496094);
+ border-right-style: solid;
+ border-right-width: 1px;
+ border-top-color: rgba(255, 255, 255, 0.496094);
+ border-top-left-radius: 5px;
+ border-top-right-radius: 5px;
+ border-top-style: solid;
+ border-top-width: 1px;
+ color: black;
+ font-family: 'DejaVu Sans', Helvetica, Arial, sans-serif;
+ font-size: 20px;
+ font-style: normal;
+ font-variant: normal;
+ font-weight: normal;
+ height: 45px;
+}
+
+label.qnx {
+ font-family: "DejaVu Sans" Helvetica, Arial, sans-serif;
+ font-style: normal;
+ font-variant: normal;
+ font-weight: normal;
+ line-height: 45px;
+ height: 45px;
+ display: inline-block;
+ color: #000000;
+}
+
+input.qnx {
+ -webkit-border-radius: 5px;
+ border: 1px rgba(0,0,0,0.5) solid;
+ display: inline-block;
+ outline-bottom: 1px #fff solid;
+ -webkit-box-shadow: 1px 1px 0px rgba(255,255,255,1);
+ height: 35px;
+ font-family: "DejaVu Sans" Helvetica, Arial, sans-serif;
+ font-size: 20px;
+ font-style: normal;
+ font-variant: normal;
+ font-weight: normal;
+ padding: 5px 10px 5px 10px;
+}
+
+textarea.qnx {
+ -webkit-border-radius: 5px;
+ border: 1px rgba(0,0,0,0.5) solid;
+ display: inline-block;
+ outline-bottom: 1px #fff solid;
+ -webkit-box-shadow: 1px 1px 0px rgba(255,255,255,1);
+ height: 35px;
+ font-family: "DejaVu Sans" Helvetica, Arial, sans-serif;
+ font-size: 20px;
+ font-style: normal;
+ font-variant: normal;
+ font-weight: normal;
+ padding: 5px 10px 5px 10px;
+}
+
+uibutton.qnx:hover,
+uibutton.qnx.touched {
+ background-image: -webkit-gradient(
+ linear,
+ left bottom,
+ left top,
+ color-stop(1, rgb(6,168,233)),
+ color-stop(0, rgb(0,113,199))
+ );
+ border: 1px #2ccfff solid;
+ color: #ffffff;
+}
+
+uibutton.qnx {
+ background-color: #F0F0F0;
+ background-image: -webkit-gradient(linear, 0% 100%, 0% 0%, from(#D1D2D4), to(#FCFCFC));
+ border-bottom-color: rgba(255, 255, 255, 0.496094);
+ border-bottom-left-radius: 5px;
+ border-bottom-right-radius: 5px;
+ border-bottom-style: solid;
+ border-bottom-width: 1px;
+ border-left-color: rgba(255, 255, 255, 0.496094);
+ border-left-style: solid;
+ border-left-width: 1px;
+ border-right-color: rgba(255, 255, 255, 0.496094);
+ border-right-style: solid;
+ border-right-width: 1px;
+ border-top-color: rgba(255, 255, 255, 0.496094);
+ border-top-left-radius: 5px;
+ border-top-right-radius: 5px;
+ border-top-style: solid;
+ border-top-width: 1px;
+ color: black;
+ font-family: 'DejaVu Sans', Helvetica, Arial, sans-serif;
+ font-size: 20px;
+ font-style: normal;
+ font-variant: normal;
+ font-weight: normal;
+ height: 45px;
+}
+
+.spanlinks {
+ color: #2489CE;
+ font-weight: normal;
+ text-decoration: underline;
+}
+
+/* Start: Styling to make list selection items wider and more QNX-styled. */
+.listoption {
+ height: 52px;
+ padding-top: 13px;
+ font-family: 'DejaVu Sans', Helvetica, Arial, sans-serif;
+ font-size: 20px;
+ font-style: normal;
+ font-variant: normal;
+ font-weight: normal;
+}
+
+.listoption:hover, .listoption.touched {
+ background-image: -webkit-gradient(
+ linear,
+ left bottom,
+ left top,
+ color-stop(1, rgb(6,168,233)),
+ color-stop(0, rgb(0,113,199))
+ );
+ border: 1px #2ccfff solid;
+ color: #ffffff;
+}
+
+.listoption[ui-implements=detail-disclosure]:after {
+ content: "";
+ font: normal 28px/28px Verdana;
+ color: #808080;
+ display: block;
+ height: 48px;
+ float: right;
+ margin-top: -4px;
+ margin-bottom: -20px;
+ margin-left: -10px;
+ background-color: transparent;
+ background-image: none;
+ border: 0;
+ -webkit-box-shadow: none;
+ top: 13px !important;
+}
+/* End: Styling to make list selection items wider and more QNX-styled. */
+
+/* Start: Styling to make select lists more QNX-styled. */
+tableview > tablecell:hover, tableview > tablecell.touched {
+ background-image: -webkit-gradient(
+ linear,
+ left bottom,
+ left top,
+ color-stop(1, rgb(6,168,233)),
+ color-stop(0, rgb(0,113,199))
+ );
+ color: #fff;
+}
+/* End: Styling to make select lists more QNX-styled. */
+
+.actiontweet {
+ color: #fff;
+ margin-left: 10px;
+ white-space: normal;
+ display: inline-block;
+ font-size: 18px;
+ line-height: 24px;
+}
+
+.actiontweet {
+ color: #fff;
+ margin-left: 10px;
+ white-space: normal;
+ display: inline-block;
+ font-size: 18px;
+ line-height: 24px;
+}
329 css/qnxbuttons.css
@@ -0,0 +1,329 @@
+body {
+ background: #ececec;
+
+}
+.hidden, .qnxselectdropdown.hidden {
+ display: none;
+}
+.relative {
+ position: relative;
+}
+.qnxform {
+ font-family: "DejaVu Sans" Helvetica, Arial, sans-serif;
+}
+label {
+ line-height: 45px;
+ height: 45px;
+ display: inline-block;
+}
+.qnxform button, .qnxform input[type="submit"], .qnxform input[type="button"], .qnxform .qnxselectinner {
+
+-webkit-border-radius: 5px;
+background-image: -webkit-gradient(
+ linear,
+ left bottom,
+ left top,
+ color-stop(0, rgb(209,210,212)),
+ color-stop(1, rgb(252,252,252))
+);
+border: 1px rgba(255,255,255,0.5) solid;
+margin: 0;
+padding: 0 35px;
+height: 38px;
+line-height: 35px;
+font-size: 20px;
+}
+
+.qnxform .qnxbuttonholder.active button, .qnxform .qnxbuttonholder.active input[type="submit"], .qnxform .qnxbuttonholder.active input[type="button"], .qnxform .qnxselectholder.active .qnxselectinner {
+ background-image: -webkit-gradient(
+ linear,
+ left bottom,
+ left top,
+ color-stop(1, rgb(0,184,253)),
+ color-stop(0, rgb(0,130,228))
+ );
+ border: 1px #2ccfff solid;
+ color: #fff;
+}
+.qnxbuttonholder.active, .qnxselectholder.active {
+ border: 1px #295b9a solid;
+}
+
+.qnxbuttonholder, .qnxselectholder {
+ display: inline-block;
+ -webkit-border-radius: 5px;
+ border: 1px rgba(0,0,0,0.5) solid;
+ -webkit-box-shadow: 1px 1px 1px rgba(0,0,0,0.1);
+ max-width: 500px;
+}
+
+
+.qnxform .qnxtextfieldholder {
+ background: #fff;
+ -webkit-border-radius: 5px;
+ border: 1px rgba(0,0,0,0.5) solid;
+ display: inline-block;
+ outline-bottom: 1px #fff solid;
+ -webkit-box-shadow: 1px 1px 0px rgba(255,255,255,1);
+ height: 34px;
+ position: relative;
+}
+.qnxform .qnxtextfieldholder input {
+ -webkit-box-shadow:inset 1px 1px 2px rgba(0,0,0,0.2);
+ background: transparent;
+ outline: none;
+ border: 0;
+ margin: 0;
+ padding: 0 10px;
+ font-size: 20px;
+ height: 32px;
+ line-height: 32px;
+}
+
+.qnxform .qnxtextfieldholder.focused {
+ -webkit-box-shadow: 0 0 6px #0096ff;
+ border: 1px #366889 solid;
+}
+
+.qnxform .qnxtextfieldholder div.closecross {
+ display: none;
+}
+.qnxform .qnxtextfieldholder.focused div.closecross {
+ display: block;
+ position: absolute;
+ z-index: 3;
+ right: 10px;
+ top: 9px;
+ width: 16px;
+ height: 17px;
+ background: url(images/cross.png);
+}
+
+.qnxform > div {
+ margin-bottom: 10px;
+}
+
+.qnxform .qnxtoggle {
+ -webkit-box-shadow:inset 1px 1px 3px rgba(0,0,0,0.3);
+ -webkit-border-radius: 5px;
+ border: 1px #363636 solid;
+ display: inline-block;
+ background: #e1e1e1;
+ position: relative;
+ font-size: 20px;
+}
+.qnxform .qnxtoggle .onlabel, .qnxform .qnxtoggle .offlabel {
+ display: block;
+ width: 80px;
+ float: left;
+ height: 38px;
+ line-height: 40px;
+ text-align: center;
+}
+
+.qnxform .qnxtoggle .slider {
+ height: 36px;
+ border: 1px #fff solid;
+ -webkit-border-radius: 4px;
+ background-image: -webkit-gradient(
+ linear,
+ left bottom,
+ left top,
+ color-stop(0, rgb(209,210,212)),
+ color-stop(1, rgb(252,252,252))
+ );
+ width: 80px;
+ -webkit-box-shadow: 0 0 3px #000;
+ position: absolute;
+ left: 0;
+ top: 0;
+ -webkit-transform-style: preserve-3d;
+ -webkit-transition-property: -webkit-transform;
+ -webkit-transition-duration: 350ms;
+ -webkit-transition-timing-function: ease-in;
+}
+
+.qnxform .qnxtoggle.blue {
+ background-image: -webkit-gradient(
+ linear,
+ left bottom,
+ left top,
+ color-stop(1, rgb(6,168,233)),
+ color-stop(0, rgb(0,113,199))
+ );
+}
+.qnxform .qnxtoggle.blue .onlabel {
+ color: #fff;
+}
+
+.qnxform .qnxtoggle.off .slider {
+ -webkit-transform: translate3d(0,0,0);
+}
+.qnxform .qnxtoggle.on .slider {
+ -webkit-transform: translate3d(78px,0,0);
+}
+
+.qnxform .qnxcheckbox {
+ width: 18px;
+ height: 18px;
+ -webkit-border-radius: 4px;
+ border: 1px #f0f0f0 solid;
+ background-image: -webkit-gradient(
+ linear,
+ left bottom,
+ left top,
+ color-stop(0, rgb(209,210,212)),
+ color-stop(1, rgb(252,252,252))
+ );
+}
+.qnxform .qnxcheckboxholder {
+ border: 1px rgba(0,0,0,0.5) solid;
+ -webkit-box-shadow: 1px 1px 1px rgba(0,0,0,0.1);
+ -webkit-border-radius: 5px;
+ width: 20px;
+ height: 20px;
+ display: inline-block;
+ position: relative;
+}
+
+.qnxform .qnxcheckboxholder .check {
+ width: 7px;
+ height: 19px;
+ border-left: 3px #000 solid;
+ border-top: 3px #000 solid;
+ -webkit-box-shadow: -1px -1px 1px rgba(0,0,0,0.3);
+ -webkit-transform: rotate(-135deg);
+ position: absolute;
+ top: -7px;
+ left: 8px;
+}
+
+.qnxselectholder .arrowholder .arrow {
+ width: 11px;
+ height: 11px;
+ background: #fff;
+ -webkit-border-radius: 2px;
+ -webkit-border-bottom-right-radius: 0;
+ -webkit-transform: rotate(45deg);
+ position: relative;
+ bottom: 4px;
+ left: 2px;
+}
+
+.qnxselectholder.active .arrowholder .arrow {
+ width: 11px;
+ height: 11px;
+ background: #fff;
+ -webkit-border-radius: 2px;
+ -webkit-border-top-left-radius: 0;
+ -webkit-transform: rotate(45deg);
+ position: relative;
+ bottom: -2px;
+ left: 2px;
+}
+
+.qnxselectholder {
+ position: relative;
+ padding-right: 40px;
+ z-index: 2;
+}
+.qnxselectholder.lowered {
+ z-index: 0;
+}
+
+.arrowholder {
+ text-align: center;
+ width: 15px;
+ height: 9px;
+ overflow: hidden;
+ display: inline-block;
+ position: absolute;
+ top: 16px;
+ right: 12px;
+}
+.qnxform .qnxselectholder .qnxselectinner {
+ line-height: 40px;
+ border-right: none;
+ border-top-right-radius: 0;
+ border-bottom-right-radius: 0;
+ white-space: nowrap;
+ overflow: hidden;
+ text-overflow: ellipsis;
+}
+.qnxselectright {
+ height: 38px;
+ width: 41px;
+ position: absolute;
+ right: 0;
+ top: 0;
+ background-image: -webkit-gradient(
+ linear,
+ left bottom,
+ left top,
+ color-stop(0, rgb(161,165,168)),
+ color-stop(1, rgb(201,200,205))
+ );
+ border: 1px #ccc solid;
+ border-left: none;
+ -webkit-border-top-right-radius: 4px;
+ -webkit-border-bottom-right-radius: 4px;
+}
+.qnxselectholder.active .qnxselectright {
+ background-image: -webkit-gradient(
+ linear,
+ left bottom,
+ left top,
+ color-stop(0, rgb(16,101,168)),
+ color-stop(1, rgb(5,141,217))
+ );
+ border: 1px #149ce8 solid;
+ border-left: none;
+
+}
+
+
+
+.qnxselectdropdown {
+ position: absolute;
+ top: 39px;
+ left: 0;
+ z-index: 1;
+ display: inline-block;
+ -webkit-border-bottom-left-radius: 5px;
+ -webkit-border-bottom-right-radius: 5px;
+ border: 1px rgba(0,0,0,0.5) solid;
+ border-top: none;
+ -webkit-box-shadow: 1px 1px 1px rgba(0,0,0,0.1);
+}
+.qnxselectdropdown ul {
+ display: inline-block;
+ list-style-type: none;
+ -webkit-border-bottom-left-radius: 4px;
+ -webkit-border-bottom-right-radius: 4px;
+ background: #f3f3f3;
+ border: 1px rgba(255,255,255,0.5) solid;
+ border-top: none;
+ margin: 0;
+ padding: 5px 1px 1px 1px;
+ line-height: 35px;
+ font-size: 20px;
+ max-width: 535px;
+}
+.qnxselectdropdown ul li {
+ height: 45px;
+ line-height: 45px;
+ padding: 0 35px;
+ white-space: nowrap;
+ overflow: hidden;
+ text-overflow: ellipsis;
+}
+.qnxselectdropdown ul li.active {
+ background-image: -webkit-gradient(
+ linear,
+ left bottom,
+ left top,
+ color-stop(0, rgb(27,100,211)),
+ color-stop(1, rgb(2,141,246))
+ );
+ color: #fff;
+}
1  data.html
@@ -0,0 +1 @@
+{"J":5,"0":"N"}
6 data/account_settings.html
@@ -0,0 +1,6 @@
+<p>
+ You are currently authorized as <b>${screen_name}</b>.
+ <uibutton class="qnx" style="width: 200px; margin-top: 20px;" onclick="doAuthRemove();">
+ <label>Remove Account</label>
+ </uibutton>
+</p>
26 data/account_settings_notsetup.html
@@ -0,0 +1,26 @@
+<p>
+ A Twitter account has not been set up for use with Lemma. To set up an account, follow the instructions found below:
+ <ol>
+ <li>
+ Click the <b>Launch Browser</b> button found below to launch a browser session.<br />
+ <uibutton class="qnx" style="width: 200px; margin-top: 10px;" onclick="doAuthGetPIN();">
+ <label>Launch Browser</label>
+ </uibutton>
+ </li>
+ <li style="margin-top: 20px;">Log in to your Twitter account and authorize the Lemma application.</li>
+ <li style="margin-top: 20px;">
+ Make note of the PIN code displayed and enter it below.
+ <div style="margin: 10px 0 0 5px; height: 50px; width: 600px;">
+ <div style="float: left;">
+ <input id="accessPIN" class="qnx" type="text" />
+ </div>
+ <div style="float: left;">
+ <uibutton class="qnx" style="width: 125px;" onclick="doAuthStepTwo();">
+ <label>Authorize!</label>
+ </uibutton>
+ </div>
+ </div>
+ </li>
+ <li style="margin-top: 20px;">Start using Lemma!</li>
+ </ol>
+</p>
3  data/list.html
@@ -0,0 +1,3 @@
+<tablecell onclick="viewList('${id_str}', '${name}', 1);" class="listoption" ui-implements="detail-disclosure">
+ <celltitle>${name}</celltitle>
+</tablecell>
14 data/timeline.html
@@ -0,0 +1,14 @@
+<tablecell ui-usage="image" ui-implements="celltitle-with-button" class="ui-no-hover">
+ <img onclick="viewUser('${screen_name}');" src="${profile_image_url}" class="fullprofileimgheight" />
+ <cellsubtitle>
+ <div style="height: 73px;" id="tweet_${id}">
+ <div style="height: 49px;">${text}</div>
+ <div id="user_tweet_${id}" style="font-size: 12px; float: left; color: #666;" onclick="viewUser('${screen_name}');">${screen_name}</div>
+ <div style="font-size: 12px; float: right; color: #666;">${created_at}</div>
+ </div>
+ <div id="raw_tweet_${id}" style="display: none;">${raw_text}</div>
+ </cellsubtitle>
+ <uibutton ui-kind="icon" class="fullbuttonheight" onclick="doAction('tweet_${id}');" ontouchend="doAction('tweet_${id}');">
+ <img src="images/actions.png" />
+ </uibutton>
+</tablecell>
9 data/timeline_settings.html
@@ -0,0 +1,9 @@
+<tableview ui-kind="grouped" id="activityChoices" ui-implements="selection-list">
+ <tableheader>
+ Maximum number of tweets shown in a timeline:
+ </tableheader>
+ <tablecell id="num_timeline_25" ui-value="25"><celltitle>25</celltitle></tablecell>
+ <tablecell id="num_timeline_50" ui-value="50"><celltitle>50</celltitle></tablecell>
+ <tablecell id="num_timeline_100" ui-value="100"><celltitle>100</celltitle></tablecell>
+ <tablecell id="num_timeline_200" ui-value="200"><celltitle>200</celltitle></tablecell>
+</tableview>
BIN  icon.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN  images/actions.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN  images/ajax-loader.gif
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN  images/refresh.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN  images/reply.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
456 index.html
@@ -0,0 +1,456 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+ <meta charset="utf-8" />
+ <meta name="viewport" content="initial-scale=1.0, maximum-scale=1.0;" />
+ <title>Lemma</title>
+ <link rel="stylesheet" href="chui/chui.css" />
+ <link rel="stylesheet" href="css/lemma.css" />
+ <script src="chui/chocolatechip.js" type="text/javascript"></script>
+ <script src="chui/chui.js" type="text/javascript"></script>
+ <script src="js/jsOAuth-1.2.min.js" type="text/javascript"></script>
+ <script src="js/key.js" type="text/javascript"></script>
+ <script src="js/lemma.js" type="text/javascript"></script>
+ <script src="js/list.js" type="text/javascript"></script>
+ <script src="js/search.js" type="text/javascript"></script>
+ <script src="js/navigation.js" type="text/javascript"></script>
+ <script src="js/datehelper.js" type="text/javascript"></script>
+ <script type="text/javascript">
+ /* Local JavaScript Here */
+ function doRefresh( since_id, insert_more ) {
+ var url = 'http://api.twitter.com/1/statuses/home_timeline.json';
+
+ updateViewName('Retrieving tweets...', CONST_LOADING);
+
+ if (insert_more === undefined) {
+ insert_more = false;
+ }
+ if (since_id === undefined) {
+ url = url + '?count=' + status_count;
+ }
+ else {
+ url = url + '?count=' + status_count;
+ url = url + '&max_id=' + since_id;
+ $('#more_timeline').remove();
+ }
+
+ oauth.get(url,
+ function(data) {
+ var json_data = JSON.parse(data.text);
+
+ updateTimeline(json_data, insert_more, CONST_HOME);
+
+ current_view = 'All';
+ updateViewName('All', CONST_HOME);
+ untouchButtons();
+ }
+ );
+ }
+
+ function doAction( tweet_id ) {
+ var action_id = 'actionsheet' + tweet_id;
+
+ // Set the ID of the tweet for the actions.
+ reply_id = tweet_id.substring(6, (tweet_id.length + 1));
+
+ // Set the text (marked up and raw) of the tweet.
+ str_tweet = $('#' + tweet_id).innerHTML;
+ str_tweet_raw = $('#raw_' + tweet_id).innerHTML;
+ str_tweet_user = $('#user_' + tweet_id).innerHTML;
+
+ var opts = {
+ id : action_id,
+ title : str_tweet,
+ color : "black",
+ uiButtons : [
+ { title : "Reply", callback: "respondToReplyButton" },
+ { title : "Retweet", callback: "respondToRetweetButton" },
+ { title : "Retweet With Message", callback: "respondToRetweetWithMessageButton" },
+ { title : "Send Direct Message", callback: "respondToDirectMessageButton" },
+ { title : "Favourite", callback: "respondToFavouriteButton" }
+ ]
+ };
+ $.body.UIActionSheet(opts);
+
+ $.UIShowActionSheet('#' + action_id);
+ }
+
+ function respondToReplyButton() {
+ $('#tweet_textarea').value = '@' + str_tweet_user + ' ';
+ $('#in_reply_to_status_id').fill(reply_id);
+ $("#tweet_result").empty();
+ gotoPage('#tweet_view');
+ countTweetChars();
+
+ setTimeout("setCaretToPos($('#tweet_textarea'), " + (str_tweet_user.length + 2) + ", " + (str_tweet_user.length + 2) + ")", 1000);
+ }
+
+ function respondToRetweetButton() {
+ postRetweet();
+ }
+
+ function respondToFavouriteButton() {
+ postFavourite();
+ }
+
+ function respondToRetweetWithMessageButton() {
+ $('#tweet_textarea').value = 'RT @' + str_tweet_user + ' ' + str_tweet_raw;
+ $('#in_reply_to_status_id').fill(reply_id);
+ gotoPage('#tweet_view');
+ countTweetChars();
+
+ setTimeout("setCaretToPos($('#tweet_textarea'), 0, 0)", 1000);
+ }
+
+ function executeView( view_name ) {
+ switch ( view_name ) {
+ case '#user_view':
+ setTimeout("setCaretToPos($('#user_textarea'), 0, 0)", 1000);
+ break;
+ case '#search_view':
+ setTimeout("setCaretToPos($('#search_textarea'), 0, 0)", 1000);
+ break;
+ case '#options_timeline_view':
+ var content = $("#timeline_settings_text").empty();
+ content.xhr("data/timeline_settings.html", {
+ successCallback: function() {
+ content.fill($.make($.responseText));
+ $("#activityChoices").UISelectionList(function(item) {
+ status_count = item.getAttribute("ui-value");
+ localStorage.setItem('status_count', status_count);
+ });
+ $('#num_timeline_' + status_count).addClass("selected");
+ $.responseText = null;
+ }
+ });
+ break;
+ case '#options_account_view':
+ if ( accountIsSet == null ) {
+ var content = $("#account_settings_text").empty();
+ content.xhr("data/account_settings_notsetup.html");
+ }
+ else {
+ var content = $("#account_settings_text");
+ content.xhr("data/account_settings.html", {
+ successCallback: function() {
+ var str_response = $.responseText;
+ str_response = str_response.replace('${screen_name}', accountScreenName);
+ content.fill($.make(str_response));
+ $.responseText = null;
+ }
+ });
+ }
+ break;
+ }
+ }
+
+ function countTweetChars() {
+ var chars_remaining = 140 - $('#tweet_textarea').value.length;
+
+ $('#tweet_chars').fill(String(chars_remaining));
+ }
+
+ function setSelectionRange(input, selectionStart, selectionEnd) {
+ if (input.setSelectionRange) {
+ input.focus();
+ input.setSelectionRange(selectionStart, selectionEnd);
+ }
+ else if (input.createTextRange) {
+ var range = input.createTextRange();
+ range.collapse(true);
+ range.moveEnd('character', selectionEnd);
+ range.moveStart('character', selectionStart);
+ range.select();
+ }
+ }
+
+ function setCaretToPos (input, pos) {
+ setSelectionRange(input, pos, pos);
+ }
+
+ $.ready(function() {
+ $.app.delegate("uibutton", "click", function(item) {
+ if (item.getAttribute("ui-implements") === "back-custom") {
+ goBack();
+ }
+ });
+
+ $("#btn_compose").bind("click", function() {
+ $('#tweet_textarea').value = '';
+ $("#tweet_result").empty();
+ gotoPage('#tweet_view');
+
+ setTimeout("setCaretToPos($('#tweet_textarea'), 0, 0)", 500);
+ });
+
+ $("#btn_inbox").bind("click", function() {
+ gotoPage('#inbox_view');
+ });
+
+ $("#btn_options").bind("click", function() {
+ gotoPage('#options_view');
+ });
+
+ $("#btn_listprev").bind("click", function() {
+ viewListPrev(accountID, accountScreenName);
+ });
+
+ $("#btn_lists").bind("click", function() {
+ goLists(accountID, accountScreenName);
+ });
+
+ $("#btn_all").bind("click", function() {
+ doRefresh();
+ });
+
+ $("#btn_listnext").bind("click", function() {
+ viewListNext(accountID, accountScreenName);
+ });
+
+ if ( just_launched == 1 ) {
+ just_launched = 0;
+ if ( accountIsSet != null ) {
+ doRefresh();
+ }
+ else {
+ gotoPage('#options_account_view');
+ }
+ }
+ });
+ </script>
+</head>
+<body>
+ <app>
+ <view ui-navigation-status="current" id="main" ui-background-style="slanted-right">
+ <subview id="timeline_subview" ui-associations="withBottomToolBar"></subview>
+ <toolbar ui-placement="bottom">
+ <segmentedcontrol>
+ <uibutton id="btn_compose" class="ui-custom-tint">
+ <label>Compose</label>
+ </uibutton>
+ <uibutton id="btn_inbox" class="ui-custom-tint">
+ <label>Inbox</label>
+ </uibutton>
+ <uibutton id="btn_options" class="ui-custom-tint">
+ <label>Options</label>
+ </uibutton>
+ </segmentedcontrol>
+
+ <segmentedcontrol>
+ <uibutton class="ui-custom-tint">
+ <label id="btn_current_view"><span onclick="doRefresh();"><img src="images/refresh.png" style="vertical-align: text-bottom;" /> All</span></label>
+ </uibutton>
+ </segmentedcontrol>
+
+ <segmentedcontrol ui-bar-align="right">
+ <uibutton id="btn_listprev" class="ui-custom-tint">
+ <label>Previous</label>
+ </uibutton>
+ <uibutton id="btn_all" class="ui-custom-tint" style="width: 55px;">
+ <label>All</label>
+ </uibutton>
+ <uibutton id="btn_lists" class="ui-custom-tint">
+ <label>Lists</label>
+ </uibutton>
+ <uibutton id="btn_listnext" class="ui-custom-tint" style="width: 61px;">
+ <label>Next</label>
+ </uibutton>
+ </segmentedcontrol>
+ </toolbar>
+ <screencover ui-visible-state="hidden"></screencover>
+ </view>
+
+ <view ui-navigation-status="upcoming" id="options_view" ui-background-style="slanted-right">
+ <navbar>
+ <uibutton class="ui-custom-tint" ui-bar-align="left" ui-implements="back-custom">
+ <label>Back</label>
+ </uibutton>
+ <h1>Options</h1>
+ </navbar>
+ <subview id="options_subview" ui-associations="withNavBar">
+ <scrollpanel>
+ <tableview style="margin-top: 16px;">
+ <tablecell onclick="gotoPage('#options_account_view');" class="listoption" ui-implements="detail-disclosure">
+ <celltitle>Account Settings</celltitle>
+ </tablecell>
+ <tablecell onclick="gotoPage('#options_timeline_view');" class="listoption" ui-implements="detail-disclosure">
+ <celltitle>Timeline Settings</celltitle>
+ </tablecell>
+ </tableview>
+ </scrollpanel>
+ </subview>
+ </view>
+
+ <view ui-navigation-status="upcoming" id="options_account_view" ui-background-style="slanted-right">
+ <navbar>
+ <uibutton class="ui-custom-tint" ui-bar-align="left" ui-implements="back-custom">
+ <label>Back</label>
+ </uibutton>
+ <h1>Account Settings</h1>
+ </navbar>
+ <subview id="options_account_subview" ui-associations="withNavBar">
+ <scrollpanel>
+ <tableview style="margin-top: 16px;" ui-kind="grouped">
+ <tablecell class="ui-no-hover">
+ <celldetail id="account_settings_text" class="ui-custom-tint"></celldetail>
+ </tablecell>
+ </tableview>
+ </scrollpanel>
+ </subview>
+ </view>
+
+ <view ui-navigation-status="upcoming" id="options_timeline_view" ui-background-style="slanted-right">
+ <navbar>
+ <uibutton class="ui-custom-tint" ui-bar-align="left" ui-implements="back-custom">
+ <label>Back</label>
+ </uibutton>
+ <h1>Timeline Settings</h1>
+ </navbar>
+ <subview id="timeline_settings_subview" ui-associations="withNavBar">
+ <scrollpanel>
+ <tableview style="margin-top: 16px;" ui-kind="grouped">
+ <tablecell class="ui-no-hover">
+ <celldetail id="timeline_settings_text" class="ui-custom-tint"></celldetail>
+ </tablecell>
+ </tableview>
+ </scrollpanel>
+ </subview>
+ </view>
+
+ <view ui-navigation-status="upcoming" id="inbox_view" ui-background-style="slanted-right">
+ <navbar>
+ <uibutton class="ui-custom-tint" ui-bar-align="left" ui-implements="back-custom">
+ <label>Back</label>
+ </uibutton>
+ <h1>Inbox</h1>
+ </navbar>
+ <subview id="inbox_subview" ui-associations="withNavBar">
+ <scrollpanel>
+ <tableview style="margin-top: 16px;">
+ <tablecell onclick="viewDirectMessages(1);" class="listoption" ui-implements="detail-disclosure">
+ <celltitle>Direct Messages</celltitle>
+ </tablecell>
+ <tablecell onclick="viewMentions(1);" class="listoption" ui-implements="detail-disclosure">
+ <celltitle>Mentions</celltitle>
+ </tablecell>
+ <tablecell onclick="gotoPage('#search_view');" class="listoption" ui-implements="detail-disclosure">
+ <celltitle>Search</celltitle>
+ </tablecell>
+ <tablecell onclick="gotoPage('#user_view');" class="listoption" ui-implements="detail-disclosure">
+ <celltitle>View User</celltitle>
+ </tablecell>
+ </tableview>
+ </scrollpanel>
+ </subview>
+ </view>
+
+ <view ui-navigation-status="upcoming" id="misc_view" ui-background-style="slanted-right">
+ <navbar>
+ <uibutton class="ui-custom-tint" ui-bar-align="left" ui-implements="back-custom">
+ <label>Back</label>
+ </uibutton>
+ <h1 id="misc_header">Header</h1>
+ </navbar>
+ <subview id="misc_subview" ui-associations="withNavBar">
+ <scrollpanel>
+ <tableview style="margin-top: 16px;" ui-kind="grouped">
+ <tablecell class="ui-no-hover">
+ <celldetail id="misc_text" class="ui-custom-tint">Body</celldetail>
+ </tablecell>
+ </tableview>
+ </scrollpanel>
+ </subview>
+ </view>
+
+ <view ui-navigation-status="upcoming" id="lists_view" ui-background-style="slanted-right">
+ <navbar>
+ <uibutton class="ui-custom-tint" ui-bar-align="left" ui-implements="back-custom">
+ <label>Back</label>
+ </uibutton>
+ <h1>Lists</h1>
+ </navbar>
+ <subview id="lists_subview" ui-associations="withNavBar"></subview>
+ </view>
+
+ <view ui-navigation-status="upcoming" id="search_view" ui-background-style="slanted-right">
+ <navbar>
+ <uibutton class="ui-custom-tint" ui-bar-align="left" ui-implements="back-custom">
+ <label>Back</label>
+ </uibutton>
+ <h1>Search</h1>
+ </navbar>
+ <subview id="search_subview" ui-associations="withNavBar">
+ <tableview style="margin-top: 16px;" ui-kind="grouped">
+ <tablecell class="ui-no-hover">
+ <div style="height: 175px; width: 750px; float: left;">
+ <textarea id="search_textarea" class="qnx" style="width: 700px; height: 150px;"></textarea>
+ </div>
+ <div style="height: 175px; width: 200px; float: left;">
+ <div style="width: 200px; height: 70px;">
+ <uibutton ui-kind="rounded-rectangle" style="margin: 0;" onclick="doSearch();">
+ <label style="font-family: 'DejaVu Sans', Helvetica, Arial, sans-serif; font-size: 16px;">Search</label>
+ </uibutton>
+ </div>
+ </div>
+ </tablecell>
+ </tableview>
+ </subview>
+ </view>
+
+ <view ui-navigation-status="upcoming" id="user_view" ui-background-style="slanted-right">
+ <navbar>
+ <uibutton class="ui-custom-tint" ui-bar-align="left" ui-implements="back-custom">
+ <label>Back</label>
+ </uibutton>
+ <h1>View User</h1>
+ </navbar>
+ <subview id="user_subview" ui-associations="withNavBar">
+ <tableview style="margin-top: 16px;" ui-kind="grouped">
+ <tablecell class="ui-no-hover">
+ <div style="height: 175px; width: 750px; float: left;">
+ <textarea id="user_textarea" class="qnx" style="width: 700px; height: 35px;"></textarea>
+ </div>
+ <div style="height: 175px; width: 200px; float: left;">
+ <div style="width: 200px; height: 70px;">
+ <uibutton ui-kind="rounded-rectangle" style="margin: 0;" onclick="searchUser();">
+ <label style="font-family: 'DejaVu Sans', Helvetica, Arial, sans-serif; font-size: 16px;">View User</label>
+ </uibutton>
+ </div>
+ </div>
+ </tablecell>
+ </tableview>
+ </subview>
+ </view>
+
+ <view ui-navigation-status="upcoming" id="tweet_view" ui-background-style="slanted-right">
+ <navbar>
+ <uibutton class="ui-custom-tint" ui-bar-align="left" ui-implements="back-custom">
+ <label>Back</label>
+ </uibutton>
+ <h1>Tweet</h1>
+ </navbar>
+ <subview id="tweet_subview" ui-associations="withNavBar">
+ <tableview style="margin-top: 16px;" ui-kind="grouped">
+ <tablecell class="ui-no-hover">
+ <div style="height: 175px; width: 750px; float: left;">
+ <textarea id="tweet_textarea" class="qnx" style="width: 700px; height: 150px;" onclick="countTweetChars();" onkeyup="countTweetChars();"></textarea>
+ </div>
+ <div style="height: 175px; width: 200px; float: left;">
+ <div style="width: 200px; height: 70px;">
+ <uibutton ui-kind="rounded-rectangle" style="margin: 0;" onclick="postTweet();">
+ <label style="font-family: 'DejaVu Sans', Helvetica, Arial, sans-serif; font-size: 16px;">Tweet</label>
+ </uibutton>
+ </div>
+ <div id="tweet_result" style="width: 200px; height: 70px; margin-left: 5px;"></div>
+ <div style="width: 200px; height: 30px; margin-left: 5px;">
+ <span id="tweet_chars">140</span> chars left.
+ </div>
+ <div id="in_reply_to_status_id" style="display: none;"></div>
+ </div>
+ </tablecell>
+ </tableview>
+ </subview>
+ </view>
+ </app>
+</body>
+</html>
68 js/datehelper.js
@@ -0,0 +1,68 @@
+/**
+ * Returns a description of this past date in relative terms.
+ * Takes an optional parameter (default: 0) setting the threshold in ms which
+ * is considered "Just now".
+ *
+ * Examples, where new Date().toString() == "Mon Nov 23 2009 17:36:51 GMT-0500 (EST)":
+ *
+ * new Date().toRelativeTime()
+ * --> 'Just now'
+ *
+ * new Date("Nov 21, 2009").toRelativeTime()
+ * --> '2 days ago'
+ *
+ * // One second ago
+ * new Date("Nov 23 2009 17:36:50 GMT-0500 (EST)").toRelativeTime()
+ * --> '1 second ago'
+ *
+ * // One second ago, now setting a now_threshold to 5 seconds