2 * Copyright (c) 2012, Intel Corporation.
4 * This program is licensed under the terms and conditions of the
5 * Apache License, version 2.0. The full text of the Apache License is at
6 * http://www.apache.org/licenses/LICENSE-2.0
10 (function($, undefined) {
13 var ChHeader = function(element, options) {
14 $.fn.ch_widget.Constructor(element, options);
15 this.$element = $(element);
16 this.options = $.extend({}, options);
19 ChHeader.prototype = $.extend(
21 $.fn.ch_widget.Constructor.prototype,
23 constructor: ChHeader,
26 var $this = this.$element,
27 $h = $('<h1/>').text(this.$element.text());
31 if (this.options.show_back_button) {
32 var $back = $('<button/>').addClass('btn');
33 var $icon = $('<i/>').addClass('icon-backward');
39 $back.click(function(e) {
41 $this.trigger($.Event('back'));
48 $.fn.ch_header = function(option) {
49 return this.each(function() {
51 data = $this.data('ch_header'),
52 options = typeof option == 'object' && option;
54 if ($this.data('show-back-button')) {
55 options = $.extend(options, {show_back_button: true});
59 $this.data('ch_header', (data = new ChHeader(this, options)));
63 if (typeof option == 'string')
68 $.fn.ch_button.Constructor = ChHeader;
71 * ================= */
73 $('.ch-header').ch_header('show');