This repository has been archived by the owner on Jan 19, 2022. It is now read-only.
/
index.html
180 lines (150 loc) · 5.46 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
<?xml version="1.0" encoding="UTF-8"?>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>icongrid.js</title>
<!--
Steal CSS and other styling for example page from spin.js
Please refer to https://github.com/fgnass/spin.js/tree/gh-pages/ for license.
-->
<link rel="stylesheet" type="text/css" href="assets/main.css"/>
<link rel="stylesheet" type="text/css" href="http://fonts.googleapis.com/css?family=Amaranth:400,700">
<script type="text/javascript" src="jquery-1.4.2.min.js"></script>
<!-- Load CSS & JS for icongrid -->
<link rel="stylesheet" type="text/css" media="all" href="icongrid/icongrid.css"/>
<script type="text/javascript" src="icongrid/base32.js"></script>
<script type="text/javascript" src="icongrid/icongrid.js"></script>
</head>
<body>
<div id="logo">
<h1>icongrid.js</h1>
</div>
<a id="ribbon" href="http://github.com/mozilla/icongrid"></a>
<div id="content">
<div id="download"><a href="icongrid.js">Download</a></div>
<h2>Example</h2>
<div class="container">
<div class="dashboardclipper" id="clipper" style="width: 400px; height: 300px;"></div>
</div>
<P><INPUT TYPE="BUTTON" NAME="Add Item" Value="Add Item" onClick='addFooItem({});'></P>
<h2>User Features</h2>
<ul>
<li>Direct-manipulation interface</li>
<ul>
<li>Drag or flick the page, or click the page indicator to switch pages</li>
<li>Click icons to invoke them</li>
<li>Press and hold icons to move them, even between pages</li>
<li>Press, hold, and let go without moving to delete items</li>
</ul>
<li>The icon positions are saved automatically</li>
</ul>
<h2>Developer Features</h2>
<ul>
<li>Asynchronous API</li>
<li>Works on desktop and touch devices</li>
<ul>
<li>Firefox, Safari, Chrome</li>
<li>Firefox Mobile, Mobile Safari</li>
<li>Not currently working perfectly with IE 8</li>
</ul>
<li>Multi-page, smooth scrolling</li>
<li>Any size, any number of rows and columns</li>
<li>Multiple grids per webpage</li>
<li>Represent arbitrary heterogeneous objects</li>
<li>Drag and drop to re-arrange (remembers position on reload!)</li>
</ul>
<p>View the source of this page to see how it works</p>
<h2>License</h2>
<p id="contact">
<a href="http://www.mozilla.org/MPL/">MPL 1.1/GPL 2.0/LGPL 2.1</a>
<br/>
Author: <b><a href="mailto:dwalkowski@mozilla.com">Dan Walkowski</a></b>
</p>
</div>
<div id="footer">
<a class="mozilla" href="http://mozillalabs.com">Mozilla Labs</a>
<a class="github" href="http://github.com">Hosted on GitHub</a>
</div>
</body>
<script type="text/javascript">
var myDash;
var myLayout;
var fruit_datasource;
var fooCounter = 1;
function addFooItem(theItem) {
var guid = "Foo "+ fooCounter++;
theItem.itemTitle = guid;
myDash.addItemToGrid(guid, theItem);
};
$(document).ready(function() {
fruit_datasource = {
fruitlist: {
strawberry: {
itemTitle: "Strawberry",
itemImgURL: "images/strawberry.png"
},
watermelon: {
itemTitle: "Watermelon",
itemImgURL: "images/watermelon.png"
},
apple: {
itemTitle: "Apple",
itemImgURL: "images/apple.png"
},
banana: {
itemTitle: "Banana",
itemImgURL: "images/banana.png"
},
grape: {
itemTitle: "Grape",
itemImgURL: "images/grape.png"
},
orange: {
itemTitle: "Orange",
itemImgURL: "images/orange.png"
},
papaya: {
itemTitle: "Papaya",
itemImgURL: "images/papaya.png"
},
pineapple: {
itemTitle: "Pineapple",
itemImgURL: "images/pineapple.png"
}
},
//gets the initial list of items. ideally only called at start
getItemList: function(callback) {
var list = this.fruitlist;
// Add special one
list["about:icongrid"] = {};
callback(list);
},
openItem: function(itemID) {
if (itemID == "about:icongrid")
window.open("http://mozilla.github.com/icongrid/");
else
window.open("http://www.google.com/search?q=" + itemID);
},
userRemovedItem: function(itemID, callback) {
delete this.fruitlist[itemID];
if (callback){
callback(itemID);
}
},
// if all your items have 'itemImgURL' and 'itemTitle' properties, then you don't need to implement these.
// These get called when an item doesn't have the right properties.
// Note that you can pass in data URIs for icons
getItemImgURL: function(itemID) {
if (itemID == "about:icongrid") return "http://upload.wikimedia.org/wikipedia/commons/thumb/f/f3/Question_mark_alternate.png/185px-Question_mark_alternate.png"
},
getItemTitle: function(itemID) {
if (itemID == "about:icongrid") return "About IconGrid";
}
};
var hostElement = $("#clipper");
myLayout = new GridLayout(hostElement.width(), hostElement.height(), 3, 2);
myDash = new IconGrid("mydash", hostElement, fruit_datasource, myLayout);
myDash.initialize();
myDash.refresh();
});
</script>
</html>