Skip to content

Instantly share code, notes, and snippets.

@nathanpc
nathanpc / main.js
Created June 9, 2012 19:58
Correct onscreenready Example
bb.init({
onscreenready: function (element, id) {
if (id == "main") {
var item = element.createElement('div');
item.setAttribute('data-bb-type','item');
item.setAttribute('data-bb-title','my title');
item.innerHTML = 'my description';
item.setAttribute('data-bb-img','foo.png');
element.getElementById('mylist').appendItem(item);
@nathanpc
nathanpc / main.js
Created June 9, 2012 19:57
Wrong onscreenready Example
bb.init({
onscreenready: function (element, id) {
if (id == "main") {
var item = document.createElement('div');
item.setAttribute('data-bb-type','item');
item.setAttribute('data-bb-title','my title');
item.innerHTML = 'my description';
item.setAttribute('data-bb-img','foo.png');
document.getElementById('mylist').appendItem(item);
@nathanpc
nathanpc / main.js
Created June 9, 2012 19:56
bb.init() Example
bb.init({
onscreenready: function (element, id) {
if (id == "main") {
// code to be executed before the "main" screen is loaded.
} else if (id == "add") {
// code to be executed before the "add" screen is loaded.
}
},
ondomready: function (element, id) {
if (id == "main") {
@nathanpc
nathanpc / index.html
Created June 9, 2012 19:55
Processed image-list item
<div data-bb-type="item" onclick="alert('this was clicked')" class="bb-hires-image-list-item" onmouseover="this.setAttribute('class','bb-hires-image-list-item-hover')" onmouseout="this.setAttribute('class','bb-hires-image-list-item')" x-blackberry-focusable="true"><img src="images/test.png">
<div class="details">
<span class="title">Title goes here</span>
<span class="accent-text"></span>
<div class="description">A description is welcome.</div>
</div>
</div>
@nathanpc
nathanpc / index.html
Created June 9, 2012 19:53
image-list item declaration
<div data-bb-type="item" data-bb-title="Title goes here" data-bb-img="images/test.png" onclick="alert('this was clicked')">A description is welcome.</div>
@nathanpc
nathanpc / show_tabbar.js
Created May 27, 2012 14:39
Post: How To Setup And Use NativeControls In PhoneGap
nativeControls.showTabBar();
nativeControls.showTabBarItems("books", "finished", "about");
nativeControls.selectTabBarItem("books");
@nathanpc
nathanpc / create_tab.js
Created May 27, 2012 14:39
Post: How To Setup And Use NativeControls In PhoneGap
nativeControls.createTabBarItem(
"books",
"Books",
"/www/tabs/book.png",
{"onSelect": function() {
// Do something
}}
);
@nathanpc
nathanpc / init.js
Created May 27, 2012 14:38
Post: How To Setup And Use NativeControls In PhoneGap
nativeControls = window.plugins.nativeControls;
nativeControls.createTabBar();
@nathanpc
nathanpc / index.html
Created May 27, 2012 14:35
Post: How To Setup And Use NativeControls In PhoneGap
<script src="phonegap-1.0.0.js" type="text/javascript" charset="utf-8"></script>
<script src="NativeControls.js" type="text/javascript" charset="utf-8"></script>
@nathanpc
nathanpc / phonegap_download_example.html
Created April 22, 2012 13:11
Sample code to download file from internet - Phonegap Wiki
<!DOCTYPE html>
<html>
<head>
<title></title>
<!-- Android
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no;" />
<meta charset="utf-8">-->
<!-- iPad/iPhone specific css below, add after your main css >