2
* Copyright (C) 2013 Adnane Belmadiaf <daker@ubuntu.com>
3
* License granted by Canonical Limited
5
* This file is part of ubuntu-html5-theme.
7
* This package is free software; you can redistribute it and/or modify
8
* it under the terms of the GNU Lesser General Public License as
9
* published by the Free Software Foundation; either version 3 of the
11
* (at your option) any later version.
13
* This package is distributed in the hope that it will be useful,
14
* but WITHOUT ANY WARRANTY; without even the implied warranty of
15
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
* GNU General Public License for more details.
18
* You should have received a copy of the GNU Lesser General Public
19
* License along with this program. If not, see
20
* <http://www.gnu.org/licenses/>.
24
* An Ubuntu Shape contains and decorates (with CSS styles) some markup, often an <em>img</em>.
29
<div data-role="shape" id="shapeID">
34
var shape = UI.shape("shapeID");
37
var Shape = function (id) {
43
* Associate a function with the Click event
45
* @param {Function} - The function to execute on click
47
UI.shape("id").click(function(){
48
console.log("Clicked");
51
click: function (callback) {
52
if ( ! document.getElementById(this.id)) {
53
throw "Error. id attribute: " + String(this.id) + " is not present in DOM";
55
var el = document.getElementById(this.id);
56
el.addEventListener('click', callback);