├── README.md ├── com.imobicloud.accordion ├── README.md ├── controllers │ └── widget.js ├── styles │ └── widget.tss ├── views │ └── widget.xml └── widget.json ├── com.imobicloud.ai ├── README.md ├── controllers │ └── widget.js ├── styles │ └── widget.tss ├── views │ └── widget.xml └── widget.json ├── com.imobicloud.calendar ├── README.md ├── controllers │ ├── calendar.js │ └── widget.js ├── styles │ ├── calendar.tss │ └── widget.tss ├── views │ ├── calendar.xml │ └── widget.xml └── widget.json ├── com.imobicloud.checkbox ├── README.md ├── controllers │ ├── checkbox.js │ └── widget.js ├── styles │ ├── checkbox.tss │ └── widget.tss ├── views │ ├── checkbox.xml │ └── widget.xml └── widget.json ├── com.imobicloud.dialog ├── .svn │ ├── all-wcprops │ ├── entries │ └── text-base │ │ └── widget.json.svn-base ├── README.md ├── assets │ └── .svn │ │ ├── all-wcprops │ │ └── entries ├── controllers │ ├── .svn │ │ ├── all-wcprops │ │ ├── entries │ │ └── text-base │ │ │ └── widget.js.svn-base │ └── widget.js ├── styles │ ├── .svn │ │ ├── all-wcprops │ │ ├── entries │ │ └── text-base │ │ │ └── widget.tss.svn-base │ └── widget.tss ├── views │ ├── .svn │ │ ├── all-wcprops │ │ ├── entries │ │ ├── prop-base │ │ │ └── widget.xml.svn-base │ │ └── text-base │ │ │ └── widget.xml.svn-base │ └── widget.xml └── widget.json ├── com.imobicloud.gallery ├── .svn │ ├── all-wcprops │ ├── entries │ └── text-base │ │ └── widget.json.svn-base ├── assets │ └── .svn │ │ ├── all-wcprops │ │ └── entries ├── controllers │ ├── .svn │ │ ├── all-wcprops │ │ ├── entries │ │ └── text-base │ │ │ └── widget.js.svn-base │ └── widget.js ├── styles │ ├── .svn │ │ ├── all-wcprops │ │ ├── entries │ │ └── text-base │ │ │ └── widget.tss.svn-base │ └── widget.tss ├── views │ ├── .svn │ │ ├── all-wcprops │ │ ├── entries │ │ ├── prop-base │ │ │ └── widget.xml.svn-base │ │ └── text-base │ │ │ └── widget.xml.svn-base │ └── widget.xml └── widget.json ├── com.imobicloud.html ├── README.md ├── assets │ └── webview │ │ └── html │ │ ├── css │ │ ├── index.css │ │ └── templates │ │ │ ├── comment.css │ │ │ └── comments.css │ │ ├── images │ │ └── pull-icon.png │ │ ├── index.html │ │ └── js │ │ ├── index.jsss │ │ ├── libs │ │ ├── Event.min.jsss │ │ ├── fastclick.jsss │ │ ├── iscroll.jsss │ │ ├── jquery-2.1.1.min.jsss │ │ ├── jquery.bum-smack-1.2.0.min.jsss │ │ ├── jsrender.min.jsss │ │ └── moment.min.jsss │ │ └── templates │ │ ├── comment.jsss │ │ └── comments.jsss ├── controllers │ └── widget.js ├── styles │ └── widget.tss ├── views │ └── widget.xml └── widget.json ├── com.imobicloud.keyboard_toolbar ├── controllers │ └── widget.js ├── styles │ └── widget.tss ├── views │ └── widget.xml └── widget.json ├── com.imobicloud.label ├── README.md ├── controllers │ └── widget.js ├── styles │ └── widget.tss ├── views │ └── widget.xml └── widget.json ├── com.imobicloud.linklabel ├── controllers │ └── widget.js ├── styles │ └── widget.tss ├── views │ └── widget.xml └── widget.json ├── com.imobicloud.picker ├── controllers │ ├── column.js │ ├── picker_android.js │ ├── picker_ios.js │ └── widget.js ├── styles │ ├── column.tss │ ├── picker_android.tss │ ├── picker_ios.tss │ └── widget.tss ├── views │ ├── column.xml │ ├── picker_android.xml │ ├── picker_ios.xml │ └── widget.xml └── widget.json ├── com.imobicloud.pull_to_refresh ├── controllers │ └── widget.js ├── styles │ └── widget.tss ├── views │ └── widget.xml └── widget.json ├── com.imobicloud.radio ├── controllers │ └── widget.js ├── styles │ └── widget.tss ├── views │ └── widget.xml └── widget.json ├── com.imobicloud.slide_menu ├── README.md ├── controllers │ └── widget.js ├── styles │ └── widget.tss ├── views │ └── widget.xml └── widget.json ├── com.imobicloud.slider ├── README.md ├── controllers │ └── widget.js ├── styles │ └── widget.tss ├── views │ └── widget.xml └── widget.json ├── com.imobicloud.tabbed_bar ├── README.md ├── controllers │ └── widget.js ├── styles │ └── widget.tss ├── views │ └── widget.xml └── widget.json ├── com.imobicloud.textarea ├── README.md ├── controllers │ └── widget.js ├── styles │ └── widget.tss ├── views │ └── widget.xml └── widget.json ├── com.imobicloud.toast ├── controllers │ ├── message.js │ └── widget.js ├── styles │ ├── message.tss │ └── widget.tss ├── views │ ├── message.xml │ └── widget.xml └── widget.json ├── com.imobicloud.uploader ├── README.md ├── controllers │ └── widget.js ├── styles │ └── widget.tss ├── views │ └── widget.xml └── widget.json └── pickers ├── README.md ├── date_picker.js ├── date_picker.tss ├── date_picker.xml ├── time_picker.js ├── time_picker.tss ├── time_picker.xml ├── value_picker.js ├── value_picker.tss └── value_picker.xml /README.md: -------------------------------------------------------------------------------- 1 | # Titanium UI Elements 2 | ==== 3 | 4 | -------------------------------------------------------------------------------- /com.imobicloud.accordion/README.md: -------------------------------------------------------------------------------- 1 | # Titanium UI - Accordion 2 | 3 | Accordion widget 4 | 5 | NOTE: FOR NEW UPDATES, VISIT THIS REPOSITORY: https://github.com/imobicloud/com.imobicloud.accordion -------------------------------------------------------------------------------- /com.imobicloud.accordion/controllers/widget.js: -------------------------------------------------------------------------------- 1 | var args = arguments[0] || {}, 2 | panes = []; 3 | 4 | loadContent(); 5 | 6 | /* 7 | args = { 8 | classes: '', 9 | activeIndex: null 10 | } 11 | * */ 12 | function loadContent() { 13 | if (args.classes) { 14 | $.addClass($.container, args.classes); 15 | } 16 | 17 | if (args.children) { 18 | _.each(args.children, function(child) { 19 | var index = panes.length; 20 | 21 | if (child.role == 'header') { 22 | child.paneIndex = index; 23 | 24 | child.addEventListener('click', togglePanel); 25 | } else if (child.role == 'body') { 26 | panes.push(child); 27 | 28 | child.height = index != args.activeIndex ? 0 : Ti.UI.SIZE; 29 | } 30 | 31 | $.container.add(child); 32 | }); 33 | 34 | delete args.id; 35 | delete args.children; 36 | } 37 | } 38 | 39 | function togglePanel(e) { 40 | if (this.isActive) { 41 | this.isActive = false; 42 | panes[ this.paneIndex ].height = 0; 43 | args.activeIndex = null; 44 | 45 | $.container.fireEvent('accordion:change', { isActive: false, index: this.paneIndex }); 46 | } else { 47 | this.isActive = true; 48 | panes[ this.paneIndex ].height = Ti.UI.SIZE; 49 | args.activeIndex = this.paneIndex; 50 | 51 | $.container.fireEvent('accordion:change', { isActive: true, index: this.paneIndex }); 52 | } 53 | }; -------------------------------------------------------------------------------- /com.imobicloud.accordion/styles/widget.tss: -------------------------------------------------------------------------------- 1 | ".accordion-container": { height: Ti.UI.SIZE, top: 25, layout: 'vertical', backgroundColor: '#d6d6d6' } 2 | -------------------------------------------------------------------------------- /com.imobicloud.accordion/views/widget.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /com.imobicloud.accordion/widget.json: -------------------------------------------------------------------------------- 1 | { 2 | "id": "com.imobicloud.accordion", 3 | "name": "com.imobicloud.accordion", 4 | "description" : "", 5 | "author": "", 6 | "version": "1.0", 7 | "copyright":"Copyright (c) 2012", 8 | "license":"Public Domain", 9 | "min-alloy-version": "1.0", 10 | "min-titanium-version":"2.1", 11 | "tags":"", 12 | "platforms":"android,blackberry,ios,mobileweb" 13 | } -------------------------------------------------------------------------------- /com.imobicloud.ai/README.md: -------------------------------------------------------------------------------- 1 | # Titanium UI - Activity Indicator 2 | 3 | NOTE: FOR NEW UPDATES, VISIT THIS REPOSITORY: https://github.com/imobicloud/com.imobicloud.ai -------------------------------------------------------------------------------- /com.imobicloud.ai/controllers/widget.js: -------------------------------------------------------------------------------- 1 | var aiTimeout, 2 | args = arguments[0] || {}; 3 | 4 | if (args.visible) { 5 | showAI(args.message); 6 | } 7 | 8 | exports.toggle = function(visible, message, timeout) { 9 | if (aiTimeout) { 10 | clearTimeout(aiTimeout); 11 | aiTimeout = null; 12 | } 13 | 14 | if (visible) { 15 | showAI(message); 16 | 17 | if (timeout) { 18 | aiTimeout = setTimeout(function(){ 19 | var dialog = Ti.UI.createAlertDialog({ 20 | buttonNames : ['OK'], 21 | message : 'Activity timeout', 22 | title : 'Error' 23 | }); 24 | dialog.show(); 25 | dialog.addEventListener('click', hideAI); 26 | }, timeout); 27 | } 28 | } else { 29 | hideAI(); 30 | } 31 | }; 32 | 33 | exports.unload = function() { 34 | if (aiTimeout) { 35 | clearTimeout(aiTimeout); 36 | aiTimeout = null; 37 | } 38 | }; 39 | 40 | function showAI(message) { 41 | message && ($.loadingMessage.text = message); 42 | $.loadingSpinner.show(); 43 | $.ai.visible = true; 44 | } 45 | 46 | function hideAI() { 47 | $.loadingSpinner.hide(); 48 | $.ai.visible = false; 49 | } -------------------------------------------------------------------------------- /com.imobicloud.ai/styles/widget.tss: -------------------------------------------------------------------------------- 1 | "#ai": { zIndex: 100, backgroundColor: '#80000000', visible: false, top: 0, left: 0 } 2 | ".wrapper": { width: Ti.UI.SIZE, height: Ti.UI.SIZE, borderRadius: 10, backgroundColor: "#E6000000", layout: 'vertical' } 3 | "#loadingSpinner": { color: '#fff', top: 20 } 4 | "#loadingSpinner[platform=ios]": { style: Ti.UI.iPhone.ActivityIndicatorStyle.BIG } 5 | "#loadingSpinner[platform=android]": { style: Ti.UI.ActivityIndicatorStyle.BIG } 6 | "#loadingMessage": { font: { fontSize: 14 }, color: '#fff', textAlign: 'center', width: Ti.UI.SIZE, height: Ti.UI.SIZE, top: 10, right: 30, bottom: 20, left: 30 } -------------------------------------------------------------------------------- /com.imobicloud.ai/views/widget.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /com.imobicloud.ai/widget.json: -------------------------------------------------------------------------------- 1 | { 2 | "id": "com.imobicloud.ai", 3 | "name": "com.imobicloud.ai", 4 | "description" : "", 5 | "author": "", 6 | "version": "1.0", 7 | "copyright":"Copyright (c) 2012", 8 | "license":"Public Domain", 9 | "min-alloy-version": "1.0", 10 | "min-titanium-version":"2.1", 11 | "tags":"", 12 | "platforms":"android,blackberry,ios,mobileweb" 13 | } -------------------------------------------------------------------------------- /com.imobicloud.calendar/README.md: -------------------------------------------------------------------------------- 1 | # Titanium UI - Calendar 2 | 3 | This calendar widget provides you with a very CSS customizable calendar with some basic commands. 4 | 5 | ![Calendar example](http://i.imgur.com/jGWRtbK.png?1) 6 | 7 | NOTE: FOR NEW UPDATES, VISIT THIS REPOSITORY: https://github.com/imobicloud/com.imobicloud.calendar 8 | 9 | ##Manifest 10 | * Version: 1.0 11 | * Github: https://github.com/imobicloud/ui 12 | * License: not specified yet 13 | * Author: imobicloud 14 | * Supported Platforms: Android, iOS, Mobileweb 15 | 16 | ## Adding the Calendar to Your Alloy Project 17 | 18 | * In your application's config.json file you need to include the following line in your dependencies: 19 | 20 | ``` 21 | "dependencies": { 22 | "com.imobicloud.calendar": "1.0" 23 | } 24 | ``` 25 | 26 | * Create a widgets directory in your app directory if it doesn't already exist. 27 | * Copy the com.imobicloud.calendar folder into your app/widgets directory. 28 | * NOTE: for now, we are using the momentJS version 2.8.4 (currently the included in Alloy is 2.7.0), so you need to copy a recent version on `lib` folder and `var moment = require('moment');` it to work 29 | 30 | ## Create a Calendar in the View 31 | You can add a Calendar to a view by *requiring* the calendar widget. 32 | 33 | 34 | 35 | Assign it an ID that you can use in your controller. E.g. `id="vCalendar"` You can now access the Calendar via `$.vCalendar` in your controller. 36 | The `swipeable="true"` option allows you to activate the swipe left/right on the calendar to change the current month. 37 | 38 | ``` 39 | Ti.API.info("calendar value " + $.vCalendar.value); 40 | ``` 41 | 42 | ## Detect a Calendar change 43 | You can detect a Calendar change simply adding an onChange event. 44 | 45 | 46 | 47 | You can now access the Calendar change in your controller: 48 | 49 | ``` 50 | function calendarChange(e) { 51 | // Possible values on e: 52 | // e.type: 53 | // 'month': the user has changed the current month 54 | // 'selected': the user has selected a day in the calendar 55 | 56 | // e.date: moment object with the selected day (first day of month when month changed) 57 | 58 | // e.view: view of the date to be able to add/change values. Only available when e.type = 'selected' 59 | Ti.API.info('type: ' + e.type + ' - date: ' + e.date.format("DD-MM-YYYY")); 60 | } 61 | ``` 62 | 63 | ## Styling the Calendar 64 | In order to style the widget and due to how it is build, you need to add the styles to app.tss to make it available to all the app. 65 | Use any valid properties for [Ti.UI.View object](http://docs.appcelerator.com/titanium/latest/#!/api/Titanium.UI.View). 66 | 67 | ``` 68 | ".imc-calendar": {top: 0, width: Ti.UI.FILL, height: Ti.UI.SIZE, backgroundColor:"white", borderColor: 'pink', borderWidth: 1 } 69 | ".imc-calendar-month": { height: Ti.UI.SIZE, top: 0, layout: 'vertical'} 70 | ".imc-calendar-weeks": { height: 32, top: 0.5, layout: 'horizontal', backgroundColor: 'pink' } 71 | ".imc-calendar-week": { width: "14%", height: 32, left: 0.5 } 72 | ".imc-calendar-week-label": { color: 'white', font: { fontSize: 13, fontFamily: 'HelveticaNeue-Light' } } 73 | ".imc-calendar-dates": { height: Ti.UI.SIZE, bottom: 0.5, layout: 'horizontal' } 74 | ".imc-calendar-date": { width: "14%", height: 33, top: 0.5, left: 0.5 } 75 | ".imc-calendar-date-label": { color: 'black', font: { fontSize: 13, fontFamily: 'HelveticaNeue-Light' }, touchEnabled: false } 76 | ".imc-calendar-today": { backgroundColor:"#FCF8E3" } 77 | ".imc-calendar-today-label": { color: 'black' } 78 | ".imc-calendar-disabled": { } 79 | ".imc-calendar-disabled-label": { color: 'grey' } 80 | ``` 81 | 82 | Those are for standard elements. If you need more detailed styling, you can customize individual items: 83 | 84 | ``` 85 | // There are 7 columns: 0, 1, 2, 3, 4, 5, 6 86 | // column 0 87 | ".imc-calendar-week-0": { } 88 | ".imc-calendar-week-label-0": { } 89 | ".imc-calendar-date-0": { } 90 | ".imc-calendar-date-label-0": { } 91 | // column 6 92 | ".imc-calendar-week-6": { } 93 | ".imc-calendar-week-label-6": { } 94 | ".imc-calendar-date-6": { } 95 | ".imc-calendar-date-label-6": { } 96 | ``` 97 | 98 | ## Initializing the Calendar in the Controller 99 | 100 | The Calendar is off by default. Before you open your window, you need to call the Calendar with the *init* method. For example: 101 | 102 | ``` 103 | $.vCalendar.init(); 104 | or if you want to initialize in a specific day 105 | $.vCalendar.init({ 106 | date: new Date("October 13, 2014 11:13:00") 107 | }); 108 | ``` 109 | ## Initialization Parameters 110 | 111 | | Parameter | Type | Description | 112 | | --------- | ---- | ----------- | 113 | | date | *Date* | A date to start calendar on it. | 114 | | dateFormatter | *function* | A custom function to create every date item on the calendar. If not passed the default function creates a simple view with a label inside to represent the day. | 115 | | weekFormatter | *function* | A custom function to create every weekday item on the calendar. If not passed the default function creates a simple view with a label inside to represent the weekday. | 116 | 117 | ## Accessible Methods 118 | | Method | Description | Example | 119 | | ---------- | ---- | ----------- | 120 | | get() | Retrieves the current selected day as a moment object. | `$.vCalendar.get();` | 121 | | set(date) | Sets the selected day, reloading the calendar. | `$.vCalendar.set( new Date("May 28, 2015 11:13:00") );` | 122 | | previous() | Jumps one month back. | `$.vCalendar.previous();` | 123 | | next() | Jumps one month forward. | `$.vCalendar.next();` | 124 | | getView() | The calendar has 2 children structures: [week, dates]. This function retrieves both in an array | `$.vCalendar.getView();` | 125 | | unload() | Removes the calendar from the view and all internal references | `$.vCalendar.unload();` | 126 | 127 | ## Customizing 128 | 129 | You can customize the calendar. For example, to set the week row in another language or set first day of the week: 130 | 131 | ``` 132 | var moment = require('moment'); 133 | moment.locale('en', { 134 | weekdaysShort : ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"], 135 | week : { 136 | dow : 1 // Monday is the first day of the week. 137 | } 138 | }); 139 | ``` 140 | 141 | ## Including events 142 | 143 | When you have events to add to an empty calendar, you can do two things: get the view and add it manually or reload the calendar with a custom dateFormatter. E.g.: 144 | 145 | Add a custom style for events 146 | 147 | ``` 148 | // custom events - custom dateFormatter 149 | ".imc-calendar-events": { width: Ti.UI.SIZE, height: 5, top: 75.5, layout: 'horizontal', touchEnabled: false } 150 | ".imc-calendar-event": { width: 5, height: 5, left: 1.5, right: 1.5, touchEnabled: false } 151 | ".imc-calendar-event-yellow": { backgroundColor: '#e8db07' } 152 | ".imc-calendar-event-blue": { backgroundColor: '#005ab4' } 153 | ".imc-calendar-event-red": { backgroundColor: '#ac1e1f' } 154 | ``` 155 | 156 | Now in the controller initialize the calendar with options: 157 | 158 | ``` 159 | // For custom week/date UI, use weekFormatter/dateFormatter 160 | // See com.imobicloud.calendar/controllers/calendar.js for example 161 | 162 | $.vCalendar.init({ 163 | weekFormatter: function(params) { 164 | var vDate = $.UI.create('View', { classes: 'imc-calendar-week imc-calendar-week-' + params.column }); 165 | vDate.add( $.UI.create('Label', { text: params.weekText, classes: 'imc-calendar-week-label imc-calendar-week-label-' + params.column }) ); 166 | return vDate; 167 | }, 168 | dateFormatter: function(params) { 169 | var vDate = $.UI.create('View', { date: params.dateId }); 170 | vDate.add( $.UI.create('Label', { text: params.dateText }) ); 171 | 172 | // if has events 173 | if (your condition) { 174 | var vEvents = $.UI.create('View', { classes: 'imc-calendar-events' }); 175 | vEvents.add( $.UI.create('View', { classes: 'imc-calendar-event imc-calendar-event-yellow' }) ); 176 | vEvents.add( $.UI.create('View', { classes: 'imc-calendar-event imc-calendar-event-blue' }) ); 177 | vEvents.add( $.UI.create('View', { classes: 'imc-calendar-event imc-calendar-event-red' }) ); 178 | vDate.add(vEvents); 179 | } 180 | 181 | return vDate; 182 | } 183 | }); 184 | ``` 185 | 186 | The option to manipulate the existing view can be done like this: let's change the background color of the previous day to current date (yesterday) 187 | 188 | ``` 189 | function loadEvents() { 190 | var moment = require('moment'); 191 | var yesterday = moment().subtract(1, 'd').format('DD-MM-YYYY'); 192 | 193 | // The calendar has 2 children structures: [week, dates]. We only need dates 194 | var children = $.vCalendar.getView().children[1].children; 195 | //Ti.API.info(JSON.stringify(children[0].children)); 196 | for (var i=0; i 1) { 102 | container.remove( container.children[0] ); 103 | } 104 | 105 | return $.trigger('change', { type: 'month', date: moment(oDate) }); // create a copy of oDate to prevent its value changed 106 | } 107 | 108 | // Called when a day is touched, triggers a "change" event of type "selected", the touched date 109 | // and the view in order to you can change it (add new data, change a color, etc.) 110 | function calendarClicked(e) { 111 | var view = e.source; 112 | view.date && $.trigger('change', { type: 'selected', date: moment(view.date), view: view }); 113 | } 114 | 115 | /* 116 | // DEMO: how to use selectedChange event 117 | var selectedDates = []; 118 | function selectedChange(e) { 119 | var date = e.date, 120 | view = e.view; 121 | 122 | if (selectedDates.indexOf(date) === -1) { 123 | $.addClass(view, 'imc-calendar-date-selected'); 124 | $.addClass(view.children[0], 'imc-calendar-date-selected-label'); 125 | 126 | selectedDates.push(date); 127 | } else { 128 | $.removeClass(view, 'imc-calendar-date-selected'); 129 | $.removeClass(view.children[0], 'imc-calendar-date-selected-label'); 130 | 131 | selectedDates = _.without(selectedDates, date); 132 | } 133 | } 134 | * */ 135 | 136 | function calendarSwipe(e) { 137 | var actions = { left: next, right: previous }, 138 | action = actions[e.direction]; 139 | action && action(); 140 | } 141 | -------------------------------------------------------------------------------- /com.imobicloud.calendar/styles/calendar.tss: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/imobicloud/ui/c9c6e5d270d63101393a71099e2089d24f27bfc0/com.imobicloud.calendar/styles/calendar.tss -------------------------------------------------------------------------------- /com.imobicloud.calendar/styles/widget.tss: -------------------------------------------------------------------------------- 1 | /* 2 | ".imc-calendar": { width: 320, height: Ti.UI.SIZE } 3 | ".imc-calendar-month": { height: Ti.UI.SIZE, top: 0, layout: 'vertical' } 4 | ".imc-calendar-weeks": { height: 32, top: 0.5, layout: 'horizontal' } 5 | ".imc-calendar-week": { width: 45, height: 32, left: 0.5 } 6 | ".imc-calendar-week-label": { color: '#fff', font: { fontSize: 13, fontFamily: 'HelveticaNeue-Light' } } 7 | ".imc-calendar-dates": { height: Ti.UI.SIZE, bottom: 0.5, layout: 'horizontal' } 8 | ".imc-calendar-date": { width: 45, height: 33, top: 0.5, left: 0.5 } 9 | ".imc-calendar-date-label": { color: '#fff', font: { fontSize: 13, fontFamily: 'HelveticaNeue-Light' }, touchEnabled: false } 10 | ".imc-calendar-today": { } 11 | ".imc-calendar-today-label": { color: '#2b414d' } 12 | // hide dates of next or previous month 13 | ".imc-calendar-disabled": { height: 0, visible: false, touchEnabled: false } 14 | ".imc-calendar-disabled-label": { visible: false, touchEnabled: false } 15 | 16 | // custom column styles, there are 6 columns: 0, 1, 2, 3, 4, 5, 6 17 | // column 0 18 | ".imc-calendar-week-0": { } 19 | ".imc-calendar-week-label-0": { } 20 | ".imc-calendar-date-0": { } 21 | ".imc-calendar-date-label-0": { } 22 | // column 6 23 | ".imc-calendar-week-6": { } 24 | ".imc-calendar-week-label-6": { } 25 | ".imc-calendar-date-6": { } 26 | ".imc-calendar-date-label-6": { } 27 | */ -------------------------------------------------------------------------------- /com.imobicloud.calendar/views/calendar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /com.imobicloud.calendar/views/widget.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /com.imobicloud.calendar/widget.json: -------------------------------------------------------------------------------- 1 | { 2 | "id": "com.imobicloud.calendar", 3 | "name": "com.imobicloud.calendar", 4 | "description" : "", 5 | "author": "", 6 | "version": "1.0", 7 | "copyright":"Copyright (c) 2012", 8 | "license":"Public Domain", 9 | "min-alloy-version": "1.0", 10 | "min-titanium-version":"2.1", 11 | "tags":"", 12 | "platforms":"android,ios,mobileweb" 13 | } -------------------------------------------------------------------------------- /com.imobicloud.checkbox/README.md: -------------------------------------------------------------------------------- 1 | # Titanium UI - Checkbox 2 | 3 | NOTE: FOR NEW UPDATES, VISIT THIS REPOSITORY: https://github.com/imobicloud/com.imobicloud.checkbox -------------------------------------------------------------------------------- /com.imobicloud.checkbox/controllers/checkbox.js: -------------------------------------------------------------------------------- 1 | var args = arguments[0]; 2 | 3 | init(); 4 | function init() { 5 | $.title.text = args.title; 6 | toggleSelect(args.selected); 7 | } 8 | 9 | function toggleSelect(isSelected) { 10 | $.icon.applyProperties( $.createStyle({ classes: 'imc-checkbox-icon-' + ( isSelected ? 'on' : 'off' ) }) ); 11 | $.title.applyProperties( $.createStyle({ classes: 'imc-checkbox-title-' + ( isSelected ? 'on' : 'off' ) }) ); 12 | } 13 | 14 | function checkboxClick(e) { 15 | args.selected = !args.selected; 16 | toggleSelect(args.selected); 17 | $.checkbox.fireEvent('toggle', { id: args.id, selected: args.selected }); 18 | } -------------------------------------------------------------------------------- /com.imobicloud.checkbox/controllers/widget.js: -------------------------------------------------------------------------------- 1 | /* 2 | args = { 3 | items: [ { id: 1, title: '', selected: false } ] 4 | } 5 | * */ 6 | var args = arguments[0] || {}; 7 | 8 | init(); 9 | function init() { 10 | args.items && loadCheckbox(args.items); 11 | } 12 | 13 | exports.load = function(params) { 14 | args = params; 15 | init(); 16 | }; 17 | 18 | function loadCheckbox(items) { 19 | for(var i=0,j=items.length; i 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /com.imobicloud.checkbox/views/widget.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /com.imobicloud.checkbox/widget.json: -------------------------------------------------------------------------------- 1 | { 2 | "id": "com.imobicloud.checkbox", 3 | "name": "com.imobicloud.checkbox", 4 | "description" : "", 5 | "author": "", 6 | "version": "1.0", 7 | "copyright":"Copyright (c) 2012", 8 | "license":"Public Domain", 9 | "min-alloy-version": "1.0", 10 | "min-titanium-version":"2.1", 11 | "tags":"", 12 | "platforms":"android,blackberry,ios,mobileweb" 13 | } -------------------------------------------------------------------------------- /com.imobicloud.dialog/.svn/all-wcprops: -------------------------------------------------------------------------------- 1 | K 25 2 | svn:wc:ra_dav:version-url 3 | V 73 4 | /osc/!svn/ver/8291/trunk/anahita-mobile/app/widgets/com.imobicloud.dialog 5 | END 6 | widget.json 7 | K 25 8 | svn:wc:ra_dav:version-url 9 | V 85 10 | /osc/!svn/ver/8291/trunk/anahita-mobile/app/widgets/com.imobicloud.dialog/widget.json 11 | END 12 | -------------------------------------------------------------------------------- /com.imobicloud.dialog/.svn/entries: -------------------------------------------------------------------------------- 1 | 10 2 | 3 | dir 4 | 8291 5 | https://3dots.svn.beanstalkapp.com/osc/trunk/anahita-mobile/app/widgets/com.imobicloud.dialog 6 | https://3dots.svn.beanstalkapp.com/osc 7 | 8 | 9 | 10 | 2014-04-23T02:58:18.572564Z 11 | 8291 12 | ptquang86 13 | 14 | 15 | svn:special svn:externals svn:needs-lock 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 1c8f0157-d3c3-41f5-a9ee-378bf7eef68d 28 | 29 | assets 30 | dir 31 | 32 | controllers 33 | dir 34 | 35 | styles 36 | dir 37 | 38 | views 39 | dir 40 | 41 | widget.json 42 | file 43 | 44 | 45 | 46 | 47 | 2014-04-22T09:27:14.000000Z 48 | c3838e0aee1aa091eb3dfb1ff5217abd 49 | 2014-04-23T02:58:18.572564Z 50 | 8291 51 | ptquang86 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 313 74 | 75 | -------------------------------------------------------------------------------- /com.imobicloud.dialog/.svn/text-base/widget.json.svn-base: -------------------------------------------------------------------------------- 1 | { 2 | "id": "com.imobicloud.dialog", 3 | "name": "com.imobicloud.dialog", 4 | "description" : "", 5 | "author": "", 6 | "version": "1.0", 7 | "copyright":"Copyright (c) 2012", 8 | "license":"Public Domain", 9 | "min-alloy-version": "1.0", 10 | "min-titanium-version":"2.1", 11 | "tags":"", 12 | "platforms":"android,blackberry,ios,mobileweb,tizen" 13 | } -------------------------------------------------------------------------------- /com.imobicloud.dialog/README.md: -------------------------------------------------------------------------------- 1 | # Titanium UI - Dialog 2 | 3 | NOTE: FOR NEW UPDATES, VISIT THIS REPOSITORY: https://github.com/imobicloud/com.imobicloud.dialog -------------------------------------------------------------------------------- /com.imobicloud.dialog/assets/.svn/all-wcprops: -------------------------------------------------------------------------------- 1 | K 25 2 | svn:wc:ra_dav:version-url 3 | V 80 4 | /osc/!svn/ver/8291/trunk/anahita-mobile/app/widgets/com.imobicloud.dialog/assets 5 | END 6 | -------------------------------------------------------------------------------- /com.imobicloud.dialog/assets/.svn/entries: -------------------------------------------------------------------------------- 1 | 10 2 | 3 | dir 4 | 8291 5 | https://3dots.svn.beanstalkapp.com/osc/trunk/anahita-mobile/app/widgets/com.imobicloud.dialog/assets 6 | https://3dots.svn.beanstalkapp.com/osc 7 | 8 | 9 | 10 | 2014-04-23T02:58:18.572564Z 11 | 8291 12 | ptquang86 13 | 14 | 15 | svn:special svn:externals svn:needs-lock 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 1c8f0157-d3c3-41f5-a9ee-378bf7eef68d 28 | 29 | -------------------------------------------------------------------------------- /com.imobicloud.dialog/controllers/.svn/all-wcprops: -------------------------------------------------------------------------------- 1 | K 25 2 | svn:wc:ra_dav:version-url 3 | V 85 4 | /osc/!svn/ver/8291/trunk/anahita-mobile/app/widgets/com.imobicloud.dialog/controllers 5 | END 6 | widget.js 7 | K 25 8 | svn:wc:ra_dav:version-url 9 | V 95 10 | /osc/!svn/ver/8291/trunk/anahita-mobile/app/widgets/com.imobicloud.dialog/controllers/widget.js 11 | END 12 | -------------------------------------------------------------------------------- /com.imobicloud.dialog/controllers/.svn/entries: -------------------------------------------------------------------------------- 1 | 10 2 | 3 | dir 4 | 8291 5 | https://3dots.svn.beanstalkapp.com/osc/trunk/anahita-mobile/app/widgets/com.imobicloud.dialog/controllers 6 | https://3dots.svn.beanstalkapp.com/osc 7 | 8 | 9 | 10 | 2014-04-23T02:58:18.572564Z 11 | 8291 12 | ptquang86 13 | 14 | 15 | svn:special svn:externals svn:needs-lock 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 1c8f0157-d3c3-41f5-a9ee-378bf7eef68d 28 | 29 | widget.js 30 | file 31 | 32 | 33 | 34 | 35 | 2014-04-22T09:45:31.000000Z 36 | f04a2c15afaea4784ee2b4f59de767c4 37 | 2014-04-23T02:58:18.572564Z 38 | 8291 39 | ptquang86 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 518 62 | 63 | -------------------------------------------------------------------------------- /com.imobicloud.dialog/controllers/.svn/text-base/widget.js.svn-base: -------------------------------------------------------------------------------- 1 | loadContent(arguments[0] || {}); 2 | 3 | exports.show = function() { 4 | var dialog = $.getView(); 5 | dialog.visible = true; 6 | dialog.animate({ opacity : 1 }); 7 | }; 8 | 9 | function hideDialog(e) { 10 | var dialog = $.getView(); 11 | dialog.animate({ opacity : 0 }, function() { 12 | dialog.visible = false; 13 | }); 14 | } 15 | 16 | exports.hide = hideDialog; 17 | 18 | function loadContent(args) { 19 | if (args.children) { 20 | _.each(args.children, function(child) { 21 | $.container.add(child); 22 | }); 23 | 24 | delete args.id; 25 | delete args.__parentSymbol; 26 | delete args.children; 27 | } 28 | } -------------------------------------------------------------------------------- /com.imobicloud.dialog/controllers/widget.js: -------------------------------------------------------------------------------- 1 | var events = {}; 2 | 3 | loadContent(arguments[0] || {}); 4 | 5 | exports.show = function(callback) { 6 | var dialog = $.getView(); 7 | dialog.visible = true; 8 | dialog.animate({ opacity : 1 }, callback || function() {}); 9 | }; 10 | 11 | function hideDialog(e) { 12 | $.getView().animate({ opacity : 0 }, function() { 13 | $.getView().visible = false; 14 | fireEvent('dialog:cancel'); 15 | }); 16 | } 17 | 18 | exports.hide = hideDialog; 19 | 20 | /* 21 | args = { 22 | persistent: 'false', 23 | visible: 'false', 24 | zIndex: 1 25 | } 26 | * */ 27 | function loadContent(args) { 28 | if (args.persistent != 'true') { 29 | $.overlay.addEventListener('click', hideDialog); 30 | } 31 | 32 | if (args.children) { 33 | var container = $.getView(); 34 | _.each(args.children, function(child) { 35 | container.add(child); 36 | }); 37 | 38 | delete args.id; 39 | delete args.children; 40 | } 41 | 42 | var dialog = $.getView(); 43 | 44 | if (args.zIndex) { 45 | dialog.zIndex = args.zIndex; 46 | } 47 | 48 | if (args.visible == 'true') { 49 | dialog.opacity = 1; 50 | dialog.visible = true; 51 | } 52 | } 53 | 54 | // EVENTS 55 | 56 | function fireEvent(type, data) { 57 | var callbacks = events[type]; 58 | if (callbacks) { 59 | for(var i=0,ii=callbacks.length; i 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /com.imobicloud.dialog/views/widget.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /com.imobicloud.dialog/widget.json: -------------------------------------------------------------------------------- 1 | { 2 | "id": "com.imobicloud.dialog", 3 | "name": "com.imobicloud.dialog", 4 | "description" : "", 5 | "author": "", 6 | "version": "1.0", 7 | "copyright":"Copyright (c) 2012", 8 | "license":"Public Domain", 9 | "min-alloy-version": "1.0", 10 | "min-titanium-version":"2.1", 11 | "tags":"", 12 | "platforms":"android,blackberry,ios,mobileweb,tizen" 13 | } -------------------------------------------------------------------------------- /com.imobicloud.gallery/.svn/all-wcprops: -------------------------------------------------------------------------------- 1 | K 25 2 | svn:wc:ra_dav:version-url 3 | V 74 4 | /osc/!svn/ver/8471/trunk/anahita-mobile/app/widgets/com.imobicloud.gallery 5 | END 6 | widget.json 7 | K 25 8 | svn:wc:ra_dav:version-url 9 | V 86 10 | /osc/!svn/ver/8471/trunk/anahita-mobile/app/widgets/com.imobicloud.gallery/widget.json 11 | END 12 | -------------------------------------------------------------------------------- /com.imobicloud.gallery/.svn/entries: -------------------------------------------------------------------------------- 1 | 10 2 | 3 | dir 4 | 8471 5 | https://3dots.svn.beanstalkapp.com/osc/trunk/anahita-mobile/app/widgets/com.imobicloud.gallery 6 | https://3dots.svn.beanstalkapp.com/osc 7 | 8 | 9 | 10 | 2014-05-06T03:47:00.601607Z 11 | 8471 12 | ptquang86 13 | 14 | 15 | svn:special svn:externals svn:needs-lock 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 1c8f0157-d3c3-41f5-a9ee-378bf7eef68d 28 | 29 | assets 30 | dir 31 | 32 | controllers 33 | dir 34 | 35 | styles 36 | dir 37 | 38 | views 39 | dir 40 | 41 | widget.json 42 | file 43 | 44 | 45 | 46 | 47 | 2014-05-05T07:55:25.000000Z 48 | 885b100ca059f403fa0ac985545c86e8 49 | 2014-05-06T03:47:00.601607Z 50 | 8471 51 | ptquang86 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 315 74 | 75 | -------------------------------------------------------------------------------- /com.imobicloud.gallery/.svn/text-base/widget.json.svn-base: -------------------------------------------------------------------------------- 1 | { 2 | "id": "com.imobicloud.gallery", 3 | "name": "com.imobicloud.gallery", 4 | "description" : "", 5 | "author": "", 6 | "version": "1.0", 7 | "copyright":"Copyright (c) 2012", 8 | "license":"Public Domain", 9 | "min-alloy-version": "1.0", 10 | "min-titanium-version":"2.1", 11 | "tags":"", 12 | "platforms":"android,blackberry,ios,mobileweb,tizen" 13 | } -------------------------------------------------------------------------------- /com.imobicloud.gallery/assets/.svn/all-wcprops: -------------------------------------------------------------------------------- 1 | K 25 2 | svn:wc:ra_dav:version-url 3 | V 81 4 | /osc/!svn/ver/8471/trunk/anahita-mobile/app/widgets/com.imobicloud.gallery/assets 5 | END 6 | -------------------------------------------------------------------------------- /com.imobicloud.gallery/assets/.svn/entries: -------------------------------------------------------------------------------- 1 | 10 2 | 3 | dir 4 | 8471 5 | https://3dots.svn.beanstalkapp.com/osc/trunk/anahita-mobile/app/widgets/com.imobicloud.gallery/assets 6 | https://3dots.svn.beanstalkapp.com/osc 7 | 8 | 9 | 10 | 2014-05-06T03:47:00.601607Z 11 | 8471 12 | ptquang86 13 | 14 | 15 | svn:special svn:externals svn:needs-lock 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 1c8f0157-d3c3-41f5-a9ee-378bf7eef68d 28 | 29 | -------------------------------------------------------------------------------- /com.imobicloud.gallery/controllers/.svn/all-wcprops: -------------------------------------------------------------------------------- 1 | K 25 2 | svn:wc:ra_dav:version-url 3 | V 86 4 | /osc/!svn/ver/8471/trunk/anahita-mobile/app/widgets/com.imobicloud.gallery/controllers 5 | END 6 | widget.js 7 | K 25 8 | svn:wc:ra_dav:version-url 9 | V 96 10 | /osc/!svn/ver/8481/trunk/anahita-mobile/app/widgets/com.imobicloud.gallery/controllers/widget.js 11 | END 12 | -------------------------------------------------------------------------------- /com.imobicloud.gallery/controllers/.svn/entries: -------------------------------------------------------------------------------- 1 | 10 2 | 3 | dir 4 | 8471 5 | https://3dots.svn.beanstalkapp.com/osc/trunk/anahita-mobile/app/widgets/com.imobicloud.gallery/controllers 6 | https://3dots.svn.beanstalkapp.com/osc 7 | 8 | 9 | 10 | 2014-05-06T03:47:00.601607Z 11 | 8471 12 | ptquang86 13 | 14 | 15 | svn:special svn:externals svn:needs-lock 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 1c8f0157-d3c3-41f5-a9ee-378bf7eef68d 28 | 29 | widget.js 30 | file 31 | 8481 32 | 33 | 34 | 35 | 2014-05-06T07:51:56.000000Z 36 | 8e96cb6e9cfee7040eddbed05c9a893f 37 | 2014-05-06T07:56:13.675625Z 38 | 8481 39 | ptquang86 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 2371 62 | 63 | -------------------------------------------------------------------------------- /com.imobicloud.gallery/controllers/.svn/text-base/widget.js.svn-base: -------------------------------------------------------------------------------- 1 | var args, 2 | vars = {}; 3 | 4 | exports.init = function(params) { 5 | args = _.extend({ 6 | width: Ti.Platform.displayCaps.platformWidth, 7 | gutter: 5, 8 | onClick: function(e) {} 9 | }, params); 10 | 11 | var gutter = args.gutter, 12 | space = args.width - gutter * 4, 13 | small = Math.floor(space / 3); 14 | vars.small = small; 15 | vars.medium = small * 2 + gutter; 16 | vars.large = small * 3 + gutter * 2; 17 | }; 18 | 19 | exports.load = function(photos) { 20 | if (photos.length == 0) { 21 | $.gallery.add( Ti.UI.createLabel({ text: 'No Photo', font: { fontSize: 12 }, color: '#000' }) ); 22 | return; 23 | } 24 | 25 | var positions = [], 26 | index = 0; 27 | 28 | // render 29 | 30 | var gutter = args.gutter, 31 | cell = vars.small + gutter, 32 | wrapper = Ti.UI.createView({ height: Ti.UI.SIZE, top: 0, bottom: gutter }); 33 | 34 | for(var i = 0, ii = photos.length; i < ii; i++){ 35 | var photo = photos[i], 36 | size = photo.size, 37 | rect = vars[size]; 38 | 39 | var _index = index, 40 | column = index % 3; 41 | 42 | if (size == 'small') { 43 | if (positions.length) { 44 | _index = positions.splice(0, 1); 45 | column = _index % 3; 46 | } else { 47 | index ++; 48 | } 49 | } else { 50 | if (size == 'large') { 51 | if (column > 0) { 52 | for (var j = column; j < 3; j++){ 53 | positions.push(index); 54 | index ++; 55 | }; 56 | } 57 | 58 | _index = index + 1; 59 | column = 0; 60 | 61 | index += 9; 62 | } else { 63 | if (column == 2) { 64 | positions.push(index); 65 | index ++; 66 | 67 | _index = index; 68 | column = 0; 69 | } 70 | 71 | positions.push(index + 2); 72 | 73 | if (column == 1) { 74 | index += 5; 75 | } else { 76 | positions.push(index + 5); 77 | index += 6; 78 | } 79 | } 80 | } 81 | 82 | var left = column * cell + gutter, 83 | top = Math.floor( _index / 3 ) * cell + gutter; 84 | 85 | wrapper.add(Ti.UI.createImageView({ 86 | data: photo.data, 87 | image: photo.url, 88 | width: rect, 89 | height: rect, 90 | top: top, 91 | left: left 92 | })); 93 | }; 94 | 95 | $.gallery.add(wrapper); 96 | }; 97 | 98 | exports.clear = function() { 99 | vars.selected = null; 100 | $.gallery.removeAllChildren(); 101 | }; 102 | 103 | function galleryClick(e) { 104 | var photo = e.source; 105 | 106 | if (photo.data == null) { 107 | return; 108 | } 109 | 110 | var last = vars.selected; 111 | last && last.applyProperties({ borderWidth: 0, borderColor: 'transparent' }); 112 | photo.applyProperties({ borderWidth: 2, borderColor: '#098ED1' }); 113 | vars.selected = photo; 114 | 115 | args.onClick(photo.data); 116 | } -------------------------------------------------------------------------------- /com.imobicloud.gallery/controllers/widget.js: -------------------------------------------------------------------------------- 1 | var args, 2 | vars, 3 | animation = require('alloy/animation'); 4 | 5 | exports.init = function(params) { 6 | vars = { 7 | sectionIndex: -1, 8 | sections: [] // cache available positions that we can display image 9 | }; 10 | 11 | // we use dp unit for Android 12 | 13 | var fullWidth = Ti.Platform.displayCaps.platformWidth; 14 | if (OS_ANDROID) { 15 | var measurement = require('alloy/measurement'); 16 | fullWidth = measurement.pxToDP(fullWidth); 17 | } 18 | 19 | // normalize input params 20 | 21 | args = _.extend({ 22 | column: Math.floor( fullWidth * 3 / 320 ), // Alloy.isTablet ? 6 : 3, // 23 | gutter: 5, 24 | infinite: false, 25 | width: fullWidth, 26 | onClick: function(e) {}, 27 | onLoadMore: function(e) {} 28 | }, params); 29 | 30 | /* 31 | generate templates base on column 32 | 33 | if there are 3 column: 34 | + images can have size from 1 to 3 35 | + we will have 3 templates 36 | - template_1 has 1 row, with 3 cells / image-views 37 | - template_2 has 2 rows, with 3 cells / image-views 38 | - template_3 has 3 rows, with 1 cell / image-view 39 | => we have this formula to calculate the number of image-views that we can use in one row: 40 | column * size - size * size + 1 41 | [ all cell ] - [ display cell ] + 1 42 | * */ 43 | 44 | var column = args.column, 45 | gutter = args.gutter, 46 | space = args.width - gutter * (column + 1), 47 | cell = Math.floor(space / column); 48 | 49 | var templates = {}; 50 | for (var i=1; i <= column; i++) { 51 | var size = cell * i + gutter * (i - 1); 52 | vars['size_' + i] = size; 53 | 54 | var childTemplates = []; 55 | for (var j=1, jj = column * i - i * i + 1; j <= jj; j++) { 56 | childTemplates.push({ 57 | type: 'Ti.UI.ImageView', 58 | bindId: 'photo_' + j, 59 | properties: { visible: false, width: 0, height: 0, top: -1, left: -1 } 60 | }); 61 | }; 62 | templates['template_' + i] = { 63 | properties: { height: size + gutter, selectedBackgroundColor: 'transparent', backgroundColor: 'transparent' }, 64 | childTemplates: childTemplates 65 | }; 66 | }; 67 | 68 | // no data template 69 | templates['template_no_data'] = { 70 | properties: { height: 100, selectedBackgroundColor: 'transparent', backgroundColor: 'transparent' }, 71 | childTemplates: [{ 72 | type: 'Ti.UI.Label', 73 | properties: { text: 'No photos are available!', bottom: 0, font: { fontSize: Alloy.isTablet ? 18 : 13 }, color: '#000' } 74 | }] 75 | }; 76 | 77 | var footerView = $.UI.create('View', { classes: 'gallery-ai' }); 78 | footerView.add( $.UI.create('ImageView', { classes: 'gallery-ai-image' }) ); 79 | footerView.add( $.UI.create('Label', { classes: 'gallery-ai-text' }) ); 80 | 81 | $.gallery = Ti.UI.createListView({ 82 | templates: templates, 83 | defaultItemTemplate: 'template_1', 84 | separatorColor: 'transparent', 85 | footerView: footerView 86 | }); 87 | $.gallery.addEventListener('itemclick', galleryClick); 88 | $.getView().add($.gallery); 89 | 90 | toggleAI(true); 91 | twirl(); 92 | 93 | // infinite load 94 | 95 | if (params.infinite) { 96 | vars.onLoadMore = params.onLoadMore; 97 | $.gallery.addEventListener('marker', function(e) { 98 | toggleAI(true); 99 | vars.onLoadMore(e); 100 | }); 101 | } 102 | }; 103 | 104 | exports.unload = function() { 105 | vars = null; 106 | args = null; 107 | 108 | if ($.gallery) { 109 | $.gallery.footerView = Ti.UI.createView(); 110 | $.getView().remove($.gallery); 111 | $.gallery = null; 112 | } 113 | }; 114 | 115 | exports.load = function(photos, isReset) { 116 | if (vars === null) { return; } 117 | 118 | if (photos.length) { 119 | var items = [], 120 | column = args.column, 121 | gutter = args.gutter, 122 | cell = vars['size_1']; 123 | 124 | vars.sectionIndex++; 125 | 126 | for(var i=0,ii=photos.length; i 1) { 148 | top = (Math.floor(cellIndex / column) * (cell + gutter)) + gutter; 149 | } 150 | left = ((cellIndex % column) * (cell + gutter)) + gutter; 151 | 152 | for (var j=1, jj = column * rowSize - rowSize * rowSize + 1; j <= jj; j++) { 153 | if (!item['photo_' + j]) { 154 | item[ 'photo_' + j] = { data: photo.data, image: photo.url, width: rect, height: rect, top: top, left: left, visible: true }; 155 | 156 | if (!isCurrentSection) { 157 | $.gallery.sections[sectionIndex].replaceItemsAt(rowIndex, 1, [item]); 158 | } 159 | 160 | break; 161 | } 162 | } 163 | 164 | continue; 165 | } else { 166 | /* 167 | if there is no available / fit position for this photo 168 | - we create a new row for it 169 | - store un-used position for later photos 170 | * */ 171 | store(size); 172 | } 173 | } else { 174 | store(size); 175 | } 176 | 177 | items.push({ 178 | template: 'template_' + size, 179 | photo_1: { data: photo.data, image: photo.url, width: rect, height: rect, top: top, left: left, visible: true } 180 | }); 181 | }; 182 | 183 | var section = Ti.UI.createListSection({ items: items }); 184 | if (isReset === false) { 185 | $.gallery.appendSection(section); 186 | } else { 187 | $.gallery.sections = [section]; 188 | } 189 | 190 | if (args.infinite) { 191 | $.gallery.setMarker({ sectionIndex: vars.sectionIndex, itemIndex: items.length - 2 }); 192 | } 193 | } else if (isReset !== false) { 194 | $.gallery.sections = [ Ti.UI.createListSection({ items: [{ template: 'template_no_data' }] }) ]; 195 | } 196 | 197 | toggleAI(false); 198 | 199 | // cleanup cache 200 | var cache = vars.sections[ vars.sectionIndex ]; 201 | if (_.find(cache, function(row){ return row !== null; }) == undefined) { 202 | cache = null; 203 | } 204 | }; 205 | 206 | function store(size) { 207 | var column = args.column, 208 | row; 209 | 210 | if (size < column) { 211 | row = []; 212 | for (var i=1; i <= size; i++) { 213 | for (var j=1; j <= column; j++) { 214 | row.push(j > size); 215 | }; 216 | }; 217 | } else { 218 | row = null; 219 | } 220 | 221 | var sections = vars.sections, 222 | index = vars.sectionIndex; 223 | if (sections[index]) { 224 | vars.sections[index].push(row); 225 | } else { 226 | vars.sections[index] = [row]; 227 | } 228 | } 229 | 230 | function find(size) { 231 | var sections = vars.sections, 232 | column = args.column, 233 | found = false, 234 | sectionIndex, 235 | cellIndex, 236 | rowIndex, 237 | rowSize; 238 | 239 | for (var h = 0, hh = sections.length; h < hh; h++) { 240 | sectionIndex = h; 241 | var section = sections[h]; 242 | 243 | if (section === null) { continue; } 244 | 245 | for (var i = 0, ii = section.length; i < ii; i++) { 246 | rowIndex = i; 247 | var row = section[i]; 248 | 249 | if (row === null) { continue; } 250 | 251 | for(var j = 0, jj = row.length; j < jj; j++){ 252 | if (row[j]) { 253 | cellIndex = j; 254 | rowSize = jj; 255 | var columnIndex = j % column + 1; 256 | 257 | if (size == 1) { 258 | found = true; 259 | row[j] = false; 260 | break; 261 | } 262 | // columnIndex from 1, 2 ..., 0 is the last column in row 263 | // size is > 1, so the last column is not fitted for this photo 264 | else if (columnIndex > 0) { 265 | var prev = columnIndex - 1, 266 | next = column - (prev + size), 267 | testIndex = cellIndex, 268 | cells = []; 269 | 270 | for (var k = 1; k <= size; k++) { 271 | k !== 1 && (testIndex += prev); 272 | for (var l = 1; l <= size; l++) { 273 | if (row[testIndex]) { 274 | cells.push(testIndex); 275 | testIndex++; 276 | } else { 277 | break; 278 | } 279 | }; 280 | if (cells.length < k * size) { 281 | break; 282 | } 283 | testIndex += next; 284 | }; 285 | 286 | if (cells.length >= size * size) { 287 | found = true; 288 | for (var k = 0, kk = cells.length; k < kk; k++) { 289 | row[ cells[k] ] = false; 290 | } 291 | break; 292 | } 293 | } 294 | } 295 | }; 296 | 297 | if (row.indexOf(true) == -1) { 298 | section[i] = null; 299 | } 300 | 301 | if (found) { 302 | break; 303 | } 304 | }; 305 | 306 | if (found) { 307 | break; 308 | } 309 | }; 310 | 311 | return found ? { section: sectionIndex, row: rowIndex, cell: cellIndex, size: rowSize/column } : false; 312 | } 313 | 314 | function galleryClick(e) { 315 | if (e.bindId != null) { 316 | var data = e.section.items[ e.itemIndex ][ e.bindId ].data; 317 | data && args.onClick(data); 318 | } 319 | } 320 | 321 | function toggleAI(visible) { 322 | if ($.gallery == null) { return; } 323 | 324 | var footerView = $.gallery.footerView; 325 | if (visible) { 326 | footerView.show(); 327 | } else { 328 | footerView.hide(); 329 | } 330 | }; 331 | exports.toggleAI = toggleAI; 332 | 333 | function twirl() { 334 | var duration = 2500, 335 | view = $.gallery.footerView.children[0]; 336 | 337 | if (OS_ANDROID) { 338 | var spin1 = Ti.UI.createAnimation({ 339 | duration: duration, 340 | transform: Ti.UI.create2DMatrix().rotate(0, 360) 341 | }); 342 | 343 | view.animate(spin1, twirl); 344 | } else { 345 | var localDuration = duration / 3; 346 | 347 | var spin1 = Ti.UI.createAnimation({ 348 | duration: localDuration, 349 | transform: Ti.UI.create2DMatrix().rotate(120) 350 | }); 351 | 352 | var spin2 = Ti.UI.createAnimation({ 353 | duration: localDuration, 354 | transform: Ti.UI.create2DMatrix().rotate(240) 355 | }); 356 | 357 | var spin3 = Ti.UI.createAnimation({ 358 | duration: localDuration, 359 | transform: Ti.UI.create2DMatrix().rotate(0) 360 | }); 361 | 362 | animation.chainAnimate(view, [spin1, spin2, spin3], twirl); 363 | } 364 | } -------------------------------------------------------------------------------- /com.imobicloud.gallery/styles/.svn/all-wcprops: -------------------------------------------------------------------------------- 1 | K 25 2 | svn:wc:ra_dav:version-url 3 | V 81 4 | /osc/!svn/ver/8471/trunk/anahita-mobile/app/widgets/com.imobicloud.gallery/styles 5 | END 6 | widget.tss 7 | K 25 8 | svn:wc:ra_dav:version-url 9 | V 92 10 | /osc/!svn/ver/8471/trunk/anahita-mobile/app/widgets/com.imobicloud.gallery/styles/widget.tss 11 | END 12 | -------------------------------------------------------------------------------- /com.imobicloud.gallery/styles/.svn/entries: -------------------------------------------------------------------------------- 1 | 10 2 | 3 | dir 4 | 8471 5 | https://3dots.svn.beanstalkapp.com/osc/trunk/anahita-mobile/app/widgets/com.imobicloud.gallery/styles 6 | https://3dots.svn.beanstalkapp.com/osc 7 | 8 | 9 | 10 | 2014-05-06T03:47:00.601607Z 11 | 8471 12 | ptquang86 13 | 14 | 15 | svn:special svn:externals svn:needs-lock 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 1c8f0157-d3c3-41f5-a9ee-378bf7eef68d 28 | 29 | widget.tss 30 | file 31 | 32 | 33 | 34 | 35 | 2014-05-05T08:29:00.000000Z 36 | db9f22e40d16cf27fe684477feccbacb 37 | 2014-05-06T03:47:00.601607Z 38 | 8471 39 | ptquang86 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 60 62 | 63 | -------------------------------------------------------------------------------- /com.imobicloud.gallery/styles/.svn/text-base/widget.tss.svn-base: -------------------------------------------------------------------------------- 1 | "#gallery": { scrollType: 'vertical', contentWidth: '100%' } -------------------------------------------------------------------------------- /com.imobicloud.gallery/styles/widget.tss: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/imobicloud/ui/c9c6e5d270d63101393a71099e2089d24f27bfc0/com.imobicloud.gallery/styles/widget.tss -------------------------------------------------------------------------------- /com.imobicloud.gallery/views/.svn/all-wcprops: -------------------------------------------------------------------------------- 1 | K 25 2 | svn:wc:ra_dav:version-url 3 | V 80 4 | /osc/!svn/ver/8471/trunk/anahita-mobile/app/widgets/com.imobicloud.gallery/views 5 | END 6 | widget.xml 7 | K 25 8 | svn:wc:ra_dav:version-url 9 | V 91 10 | /osc/!svn/ver/8481/trunk/anahita-mobile/app/widgets/com.imobicloud.gallery/views/widget.xml 11 | END 12 | -------------------------------------------------------------------------------- /com.imobicloud.gallery/views/.svn/entries: -------------------------------------------------------------------------------- 1 | 10 2 | 3 | dir 4 | 8471 5 | https://3dots.svn.beanstalkapp.com/osc/trunk/anahita-mobile/app/widgets/com.imobicloud.gallery/views 6 | https://3dots.svn.beanstalkapp.com/osc 7 | 8 | 9 | 10 | 2014-05-06T03:47:00.601607Z 11 | 8471 12 | ptquang86 13 | 14 | 15 | svn:special svn:externals svn:needs-lock 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 1c8f0157-d3c3-41f5-a9ee-378bf7eef68d 28 | 29 | widget.xml 30 | file 31 | 8481 32 | 33 | 34 | 35 | 2014-05-06T07:37:57.000000Z 36 | fe1d9bf491e4abcf7e1b3ae0a0dfb952 37 | 2014-05-06T07:56:13.675625Z 38 | 8481 39 | ptquang86 40 | has-props 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 67 62 | 63 | -------------------------------------------------------------------------------- /com.imobicloud.gallery/views/.svn/prop-base/widget.xml.svn-base: -------------------------------------------------------------------------------- 1 | K 13 2 | svn:mime-type 3 | V 10 4 | text/plain 5 | END 6 | -------------------------------------------------------------------------------- /com.imobicloud.gallery/views/.svn/text-base/widget.xml.svn-base: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /com.imobicloud.gallery/views/widget.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /com.imobicloud.gallery/widget.json: -------------------------------------------------------------------------------- 1 | { 2 | "id": "com.imobicloud.gallery", 3 | "name": "com.imobicloud.gallery", 4 | "description" : "", 5 | "author": "", 6 | "version": "1.0", 7 | "copyright":"Copyright (c) 2012", 8 | "license":"Public Domain", 9 | "min-alloy-version": "1.0", 10 | "min-titanium-version":"2.1", 11 | "tags":"", 12 | "platforms":"android,blackberry,ios,mobileweb,tizen" 13 | } -------------------------------------------------------------------------------- /com.imobicloud.html/README.md: -------------------------------------------------------------------------------- 1 | # Titanium UI - HTML 2 | 3 | NOTE: FOR NEW UPDATES, VISIT THIS REPOSITORY: https://github.com/imobicloud/com.imobicloud.html -------------------------------------------------------------------------------- /com.imobicloud.html/assets/webview/html/css/index.css: -------------------------------------------------------------------------------- 1 | * { margin: 0; padding: 0; } 2 | html { font-size: 100%; -webkit-text-size-adjust: 100%; } 3 | html, button, input, select, textarea { font-family: 'ArialMT'; color: #222; } 4 | body { font-size: 13px; line-height: 1.231; background-color: transparent; overflow: hidden; } 5 | a { color: #098ED1; text-decoration: none; } 6 | 7 | img { border: 0; vertical-align: middle; } 8 | .clearfix:before, .clearfix:after { content: " "; display: table; } 9 | .clearfix:after { clear: both; } 10 | .center-h{ margin-left: auto; margin-right: auto; } 11 | .center { display:-webkit-box; -webkit-box-align:center; -webkit-box-pack:center; display:box; box-align:center; box-pack:center; } 12 | .ir { display: block; text-indent: -9999px; } 13 | 14 | #app { 15 | -webkit-tap-highlight-color: rgba(0,0,0,0); 16 | -webkit-touch-callout: none; 17 | -webkit-user-select: none; 18 | -moz-user-select: none; 19 | -ms-user-select: none; 20 | user-select: none; 21 | -webkit-text-size-adjust: none; 22 | -moz-text-size-adjust: none; 23 | -ms-text-size-adjust: none; 24 | -o-text-size-adjust: none; 25 | text-size-adjust: none; 26 | } 27 | 28 | .ai-icon { 29 | display:block; float:left; 30 | width:40px; height:40px; 31 | background:url(../images/pull-icon.png) 0 0 no-repeat; 32 | -webkit-background-size:40px 40px; background-size:40px 40px; 33 | -webkit-transition-property:-webkit-transform; 34 | -webkit-transition-duration:250ms; 35 | 36 | background-position:0 100%; 37 | -webkit-transform:rotate(0deg) translateZ(0); 38 | -webkit-transition-duration:0ms; 39 | 40 | -webkit-animation-name:loading; 41 | -webkit-animation-duration:2s; 42 | -webkit-animation-iteration-count:infinite; 43 | -webkit-animation-timing-function:linear; 44 | } 45 | .mini-ai .ai-icon { width: 32px; height: 32px; background-size: 20px; background-position:center; } 46 | 47 | .ai-label { 48 | line-height: 40px; 49 | } 50 | 51 | @-webkit-keyframes loading { 52 | from { -webkit-transform:rotate(0deg) translateZ(0); } 53 | to { -webkit-transform:rotate(360deg) translateZ(0); } 54 | } 55 | 56 | @media only screen and (min-width : 480px) { 57 | body { font-size: 18px; } 58 | .mini-ai .ai-icon { width: 42px; height: 42px; background-size: 30px; } 59 | } -------------------------------------------------------------------------------- /com.imobicloud.html/assets/webview/html/css/templates/comment.css: -------------------------------------------------------------------------------- 1 | .comment { border-bottom: 1px solid #d6d6d6; position: relative; min-height: 72px; } 2 | .comment:first-child { margin-top: 16px; } 3 | .author-photo { width: 40px; height: 40px; position: absolute; top: 0; left: 0; } 4 | .author-photo > img { width: 40px; height: 40px; } 5 | .comment-header { margin: 10px 0 3px 56px; } 6 | .author-name { float: left; font-size: 14px; } 7 | .comment-time { float: right; color: #999; font-size: 14px; } 8 | .comment-content { margin: 0 0 10px 56px; color: #000; font-size: 14px; } 9 | .comment-quote { margin: 10px 2px 10px 56px; background-color: #f0f0f0; position: relative; min-height: 62px; box-shadow: 1px 1px 2px 0px rgba(50, 50, 50, 0.5); } 10 | .quote-photo { width: 30px; height: 30px; position: absolute; top: 16px; left: 16px; } 11 | .quote-photo > img { width: 30px; height: 30px; } 12 | .quote-header { padding: 16px 16px 3px 62px; } 13 | .quote-name { font-size: 12px; } 14 | .quote-link { float: right; font-size: 12px; } 15 | .quote-content { padding: 0 16px 10px 62px; font-size: 12px; } 16 | 17 | .comment-table { border: 1px solid gray; border-collapse: collapse; border-spacing: 0; } 18 | .comment-table td { padding: 5px 7px 3px; border: 1px solid gray; } 19 | 20 | .comment-image { height: 300px; } 21 | .quote-content .comment-image { height: 200px; } 22 | 23 | 24 | @media only screen and (min-width : 480px) { 25 | 26 | } -------------------------------------------------------------------------------- /com.imobicloud.html/assets/webview/html/css/templates/comments.css: -------------------------------------------------------------------------------- 1 | .nav { height: 36px; } 2 | .nav-button { float: left; width: 20%; height: 36px; font-size: 14px; text-align: center; line-height: 36px; } 3 | .nav-first { } 4 | .nav-prev { } 5 | .nav-next { float: right; } 6 | .nav-last { float: right; } 7 | .nav-current { } 8 | #comments { margin: 0 16px; overflow: hidden; } 9 | 10 | @media only screen and (min-width : 480px) { 11 | 12 | } -------------------------------------------------------------------------------- /com.imobicloud.html/assets/webview/html/images/pull-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/imobicloud/ui/c9c6e5d270d63101393a71099e2089d24f27bfc0/com.imobicloud.html/assets/webview/html/images/pull-icon.png -------------------------------------------------------------------------------- /com.imobicloud.html/assets/webview/html/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | News Feed 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 | 16 |
17 | 18 | Loading... 19 |
20 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /com.imobicloud.html/assets/webview/html/js/index.jsss: -------------------------------------------------------------------------------- 1 | var eventName; 2 | 3 | $(function(){ 4 | FastClick.attach(document.body); 5 | 6 | // fix Feed not display on Nexus 7 (Android 4.4.2) 7 | 8 | var ua = navigator.userAgent.toLowerCase(), 9 | isAndroid = ua.indexOf("android") > -1, //&& ua.indexOf("mobile"); 10 | androidVersion = isAndroid ? parseFloat(ua.slice(ua.indexOf("android")+8)) : 0; 11 | 12 | if (androidVersion > 4.3) { 13 | $(document.body).css({ 14 | 'height': window.innerHeight, 15 | 'position': 'relative' 16 | }); 17 | } 18 | 19 | // prevent default long press (long press on links will show open dialog) 20 | // http://atmarkplant.com/ios-wkwebview-tips/#longpress 21 | document.body.style.webkitTouchCallout='none'; 22 | }); 23 | 24 | var UTILS = { 25 | init: function(_eventName) { 26 | eventName = _eventName; 27 | }, 28 | 29 | fireEvent: function(e, type, data) { 30 | if (e) { 31 | e.preventDefault(); 32 | e.stopPropagation(); 33 | } 34 | 35 | data == null && (data = {}); 36 | data.etype = type; 37 | 38 | Ti.App.fireEvent(eventName, data); 39 | }, 40 | 41 | /* 42 | params = { 43 | data: [], 44 | template: '' 45 | } 46 | * */ 47 | render: function(params) { 48 | return $.templates[params.template].render(params.data); 49 | }, 50 | 51 | scroll: function(scrollToTop) { 52 | $("html, body").animate({ scrollTop: scrollToTop ? 0 : $(document).height() }, "slow"); 53 | }, 54 | 55 | stringify: function(obj) { 56 | return typeof obj == 'object' ? JSON.stringify(obj) : obj; 57 | }, 58 | 59 | parseHTML: function(text, useHash, useTag) { 60 | var lineRegex = /\r?\n/g; 61 | var phoneRegex = /(\(?([0-9]{3})\)?[-. ]?([0-9]{3})[-.]([0-9]{4}))/gi; 62 | // http://blog.mattheworiordan.com/post/13174566389/url-regular-expression-for-links-with-or-without-the 63 | var urlRegex = /((([A-Za-z]{3,9}:(?:\/\/)?)(?:[\-;:&=\+\$,\w]+@)?[A-Za-z0-9\.\-]+|(?:www\.|[\-;:&=\+\$,\w]+@)[A-Za-z0-9\.\-]+)((?:\/[\+~%\/\.\w\-_]*)?\??(?:[\-\+=&;%@\.\w_]*)#?(?:[\.\!\/\\\w]*))?)/gi; 64 | 65 | var html = text 66 | .replace(lineRegex, '
') 67 | .replace(urlRegex, '$1') 68 | .replace(phoneRegex, '$1'); 69 | 70 | if (useHash) { 71 | var hashTagRegex = /(^|\B)#(([a-zA-Z_]+\w*)|(\d+([,.]\d+)?))/gi; 72 | html = html.replace(hashTagRegex, '$1#$2'); 73 | } 74 | 75 | if (useTag) { 76 | var mentionRegex = /(^|\s)@(\w+)/gi; 77 | html = html.replace(mentionRegex, '$1@$2'); 78 | } 79 | 80 | return html; 81 | }, 82 | 83 | validateURL: function(url) { 84 | var urlRegex = new RegExp('^(http|https)://', 'i'); 85 | var phoneRegex = /(\(?([0-9]{3})\)?[-. ]?([0-9]{3})[-.]([0-9]{4}))/gi; 86 | if ( !phoneRegex.test( url ) ) { 87 | if ( !urlRegex.test( url ) ) { 88 | url = 'http://' + url; 89 | } 90 | } 91 | return url; 92 | }, 93 | 94 | truncate: function(text, limit) { 95 | if (text.length <= limit) { 96 | return text; 97 | } else { 98 | var str = text.substr(0, limit); 99 | str = str.substr(0, str.lastIndexOf(' '));// remove the last word to ensure #aaa or @aaa not being cut 100 | return str; 101 | } 102 | }, 103 | 104 | showAI: function() { 105 | $('#ai').show(); 106 | }, 107 | 108 | hideAI: function() { 109 | $('#ai').hide(); 110 | } 111 | }; 112 | 113 | UTILS.onClick = function(e) { 114 | var element = e.target; 115 | 116 | while (element && element.className.indexOf('touchDisabled') != -1) { 117 | element = element.parentNode; 118 | } 119 | 120 | if (element.nodeName == 'A') { 121 | var data = $(element).data(); 122 | data.clickAction = element.hash; 123 | data.link = UTILS.validateURL(data.link); 124 | UTILS.fireEvent(e, 'click', data); 125 | return false; 126 | } else { 127 | while (element) { 128 | var data = $(element).data(); 129 | if (data.clickAction == null) { 130 | element = element.parentNode; 131 | } else { 132 | UTILS.fireEvent(e, 'click', data); 133 | break; 134 | } 135 | } 136 | } 137 | }; 138 | -------------------------------------------------------------------------------- /com.imobicloud.html/assets/webview/html/js/libs/Event.min.jsss: -------------------------------------------------------------------------------- 1 | // https://github.com/mudcube/Event.js 2 | // 26/12/2014 3 | if(eventjs===void 0)var eventjs={};if(function(e){"use strict";e.modifyEventListener=!1,e.modifySelectors=!1,e.add=function(e,t,r,o){return n(e,t,r,o,"add")},e.remove=function(e,t,r,o){return n(e,t,r,o,"remove")},e.returnFalse=function(){return!1},e.stop=function(e){e&&(e.stopPropagation&&e.stopPropagation(),e.cancelBubble=!0,e.cancelBubbleCount=0)},e.prevent=function(e){e&&(e.preventDefault?e.preventDefault():e.preventManipulation?e.preventManipulation():e.returnValue=!1)},e.cancel=function(t){e.stop(t),e.prevent(t)},e.blur=function(){var e=document.activeElement;if(e){var t=document.activeElement.nodeName;("INPUT"===t||"TEXTAREA"===t||"true"===e.contentEditable)&&e.blur&&e.blur()}},e.getEventSupport=function(e,t){if("string"==typeof e&&(t=e,e=window),t="on"+t,t in e)return!0;if(e.setAttribute||(e=document.createElement("div")),e.setAttribute&&e.removeAttribute){e.setAttribute(t,"");var n="function"==typeof e[t];return e[t]!==void 0&&(e[t]=null),e.removeAttribute(t),n}};var t=function(e){if(!e||"object"!=typeof e)return e;var n=new e.constructor;for(var r in e)n[r]=e[r]&&"object"==typeof e[r]?t(e[r]):e[r];return n},n=function(i,s,v,l,p,g){if(l=l||{},"[object Object]"==i+""){var m=i;if(i=m.target,delete m.target,!m.type||!m.listener){for(var j in m){var y=m[j];"function"!=typeof y&&(l[j]=y)}var h={};for(var w in m){var j=w.split(","),x=m[w],P={};for(var b in l)P[b]=l[b];if("function"==typeof x)var v=x;else{if("function"!=typeof x.listener)continue;var v=x.listener;for(var b in x)"function"!=typeof x[b]&&(P[b]=x[b])}for(var M=0;j.length>M;M++)h[w]=eventjs.add(i,j[M],v,P,p)}return h}s=m.type,delete m.type,v=m.listener,delete m.listener;for(var w in m)l[w]=m[w]}if(i&&s&&v){if("string"==typeof i&&"ready"===s){if(!window.eventjs_stallOnReady){var E=(new Date).getTime(),T=l.timeout,G=l.interval||1e3/60,D=window.setInterval(function(){(new Date).getTime()-E>T&&window.clearInterval(D),document.querySelector(i)&&(window.clearInterval(D),setTimeout(v,1))},G);return}s="load",i=window}if("string"==typeof i){if(i=document.querySelectorAll(i),0===i.length)return o("Missing target on listener!",arguments);1===i.length&&(i=i[0])}var L,k={};if(i.length>0&&i!==window){for(var X=0,Y=i.length;Y>X;X++)L=n(i[X],s,v,t(l),p),L&&(k[X]=L);return r(k)}if("string"==typeof s&&(s=s.toLowerCase(),-1!==s.indexOf(" ")?s=s.split(" "):-1!==s.indexOf(",")&&(s=s.split(","))),"string"!=typeof s){if("number"==typeof s.length)for(var H=0,S=s.length;S>H;H++)L=n(i,s[H],v,t(l),p),L&&(k[s[H]]=L);else for(var w in s)L="function"==typeof s[w]?n(i,w,s[w],t(l),p):n(i,w,s[w].listener,t(s[w]),p),L&&(k[w]=L);return r(k)}if(0===s.indexOf("on")&&(s=s.substr(2)),"object"!=typeof i)return o("Target is not defined!",arguments);if("function"!=typeof v)return o("Listener is not a function!",arguments);var U=l.useCapture||!1,_=d(i)+"."+d(v)+"."+(U?1:0);if(e.Gesture&&e.Gesture._gestureHandlers[s]){if(_=s+_,"remove"===p){if(!u[_])return;u[_].remove(),delete u[_]}else if("add"===p){if(u[_])return u[_].add(),u[_];if(l.useCall&&!e.modifyEventListener){var C=v;v=function(e,t){for(var n in t)e[n]=t[n];return C.call(i,e)}}l.gesture=s,l.target=i,l.listener=v,l.fromOverwrite=g,u[_]=e.proxy[s](l)}return u[_]}for(var F,O=a(s),M=0;O.length>M;M++)if(s=O[M],F=s+"."+_,"remove"===p){if(!u[F])continue;i[f](s,v,U),delete u[F]}else if("add"===p){if(u[F])return u[F];i[c](s,v,U),u[F]={id:F,type:s,target:i,listener:v,remove:function(){for(var t=0;O.length>t;t++)e.remove(i,O[t],v,l)}}}return u[F]}},r=function(e){return{remove:function(){for(var t in e)e[t].remove()},add:function(){for(var t in e)e[t].add()}}},o=function(e,t){"undefined"!=typeof console&&void 0!==console.error&&console.error(e,t)},i={msPointer:["MSPointerDown","MSPointerMove","MSPointerUp"],touch:["touchstart","touchmove","touchend"],mouse:["mousedown","mousemove","mouseup"]},s={MSPointerDown:0,MSPointerMove:1,MSPointerUp:2,touchstart:0,touchmove:1,touchend:2,mousedown:0,mousemove:1,mouseup:2};(function(){e.supports={},window.navigator.msPointerEnabled&&(e.supports.msPointer=!0),e.getEventSupport("touchstart")&&(e.supports.touch=!0),e.getEventSupport("mousedown")&&(e.supports.mouse=!0)})();var a=function(){return function(t){var n=document.addEventListener?"":"on",r=s[t];if(isFinite(r)){var o=[];for(var a in e.supports)o.push(n+i[a][r]);return o}return[n+t]}}(),u={},v=0,d=function(e){return e===window?"#window":e===document?"#document":(e.uniqueID||(e.uniqueID="e"+v++),e.uniqueID)},c=document.addEventListener?"addEventListener":"attachEvent",f=document.removeEventListener?"removeEventListener":"detachEvent";return e.createPointerEvent=function(t,n,r){var o=n.gesture,i=n.target,s=t.changedTouches||e.proxy.getCoords(t);if(s.length){var a=s[0];n.pointers=r?[]:s,n.pageX=a.pageX,n.pageY=a.pageY,n.x=n.pageX,n.y=n.pageY}var u=document.createEvent("Event");u.initEvent(o,!0,!0),u.originalEvent=t;for(var v in n)"target"!==v&&(u[v]=n[v]);var d=u.type;e.Gesture&&e.Gesture._gestureHandlers[d]&&n.oldListener.call(i,u,n,!1)},e.modifyEventListener&&window.HTMLElement&&function(){var t=function(t){var r=function(r){var o=r+"EventListener",i=t[o];t[o]=function(t,o,s){if(e.Gesture&&e.Gesture._gestureHandlers[t]){var u=s;"object"==typeof s?u.useCall=!0:u={useCall:!0,useCapture:s},n(this,t,o,u,r,!0)}else for(var v=a(t),d=0;v.length>d;d++)i.call(this,v[d],o,s)}};r("add"),r("remove")};navigator.userAgent.match(/Firefox/)?(t(HTMLDivElement.prototype),t(HTMLCanvasElement.prototype)):t(HTMLElement.prototype),t(document),t(window)}(),e.modifySelectors&&function(){var e=NodeList.prototype;e.removeEventListener=function(e,t,n){for(var r=0,o=this.length;o>r;r++)this[r].removeEventListener(e,t,n)},e.addEventListener=function(e,t,n){for(var r=0,o=this.length;o>r;r++)this[r].addEventListener(e,t,n)}}(),e}(eventjs),eventjs===void 0)var eventjs={};if(eventjs.proxy===void 0&&(eventjs.proxy={}),eventjs.proxy=function(e){"use strict";e.pointerSetup=function(e,t){e.target=e.target||window,e.doc=e.target.ownerDocument||e.target,e.minFingers=e.minFingers||e.fingers||1,e.maxFingers=e.maxFingers||e.fingers||1/0,e.position=e.position||"relative",delete e.fingers,t=t||{},t.enabled=!0,t.gesture=e.gesture,t.target=e.target,t.env=e.env,eventjs.modifyEventListener&&e.fromOverwrite&&(e.oldListener=e.listener,e.listener=eventjs.createPointerEvent);var n=0,r=0===t.gesture.indexOf("pointer")&&eventjs.modifyEventListener?"pointer":"mouse";return e.oldListener&&(t.oldListener=e.oldListener),t.listener=e.listener,t.proxy=function(n){t.defaultListener=e.listener,e.listener=n,n(e.event,t)},t.add=function(){t.enabled!==!0&&(e.onPointerDown&&eventjs.add(e.target,r+"down",e.onPointerDown),e.onPointerMove&&eventjs.add(e.doc,r+"move",e.onPointerMove),e.onPointerUp&&eventjs.add(e.doc,r+"up",e.onPointerUp),t.enabled=!0)},t.remove=function(){t.enabled!==!1&&(e.onPointerDown&&eventjs.remove(e.target,r+"down",e.onPointerDown),e.onPointerMove&&eventjs.remove(e.doc,r+"move",e.onPointerMove),e.onPointerUp&&eventjs.remove(e.doc,r+"up",e.onPointerUp),t.reset(),t.enabled=!1)},t.pause=function(t){!e.onPointerMove||t&&!t.move||eventjs.remove(e.doc,r+"move",e.onPointerMove),!e.onPointerUp||t&&!t.up||eventjs.remove(e.doc,r+"up",e.onPointerUp),n=e.fingers,e.fingers=0},t.resume=function(t){!e.onPointerMove||t&&!t.move||eventjs.add(e.doc,r+"move",e.onPointerMove),!e.onPointerUp||t&&!t.up||eventjs.add(e.doc,r+"up",e.onPointerUp),e.fingers=n},t.reset=function(){e.tracker={},e.fingers=0},t};var t=eventjs.supports;eventjs.isMouse=!!t.mouse,eventjs.isMSPointer=!!t.touch,eventjs.isTouch=!!t.msPointer,e.pointerStart=function(t,n,r){var o=(t.type||"mousedown").toUpperCase();0===o.indexOf("MOUSE")?(eventjs.isMouse=!0,eventjs.isTouch=!1,eventjs.isMSPointer=!1):0===o.indexOf("TOUCH")?(eventjs.isMouse=!1,eventjs.isTouch=!0,eventjs.isMSPointer=!1):0===o.indexOf("MSPOINTER")&&(eventjs.isMouse=!1,eventjs.isTouch=!1,eventjs.isMSPointer=!0);var i=function(e,t){var n=r.bbox,o=a[t]={};switch(r.position){case"absolute":o.offsetX=0,o.offsetY=0;break;case"differenceFromLast":o.offsetX=e.pageX,o.offsetY=e.pageY;break;case"difference":o.offsetX=e.pageX,o.offsetY=e.pageY;break;case"move":o.offsetX=e.pageX-n.x1,o.offsetY=e.pageY-n.y1;break;default:o.offsetX=n.x1-n.scrollLeft,o.offsetY=n.y1-n.scrollTop}var i=e.pageX-o.offsetX,s=e.pageY-o.offsetY;o.rotation=0,o.scale=1,o.startTime=o.moveTime=(new Date).getTime(),o.move={x:i,y:s},o.start={x:i,y:s},r.fingers++};r.event=t,n.defaultListener&&(r.listener=n.defaultListener,delete n.defaultListener);for(var s=!r.fingers,a=r.tracker,u=t.changedTouches||e.getCoords(t),v=u.length,d=0;v>d;d++){var c=u[d],f=c.identifier||1/0;if(r.fingers){if(r.fingers>=r.maxFingers){var l=[];for(var f in r.tracker)l.push(f);return n.identifier=l.join(","),s}var p=0;for(var g in a){if(a[g].up){delete a[g],i(c,f),r.cancel=!0;break}p++}if(a[f])continue;i(c,f)}else a=r.tracker={},n.bbox=r.bbox=e.getBoundingBox(r.target),r.fingers=0,r.cancel=!1,i(c,f)}var l=[];for(var f in r.tracker)l.push(f);return n.identifier=l.join(","),s},e.pointerEnd=function(e,t,n,r){for(var o=e.touches||[],i=o.length,s={},a=0;i>a;a++){var u=o[a],v=u.identifier;s[v||1/0]=!0}for(var v in n.tracker){var d=n.tracker[v];s[v]||d.up||(r&&r({pageX:d.pageX,pageY:d.pageY,changedTouches:[{pageX:d.pageX,pageY:d.pageY,identifier:"Infinity"===v?1/0:v}]},"up"),d.up=!0,n.fingers--)}if(0!==n.fingers)return!1;var c=[];n.gestureFingers=0;for(var v in n.tracker)n.gestureFingers++,c.push(v);return t.identifier=c.join(","),!0},e.getCoords=function(t){return e.getCoords=t.pageX!==void 0?function(e){return Array({type:"mouse",x:e.pageX,y:e.pageY,pageX:e.pageX,pageY:e.pageY,identifier:e.pointerId||1/0})}:function(e){var t=document.documentElement;return e=e||window.event,Array({type:"mouse",x:e.clientX+t.scrollLeft,y:e.clientY+t.scrollTop,pageX:e.clientX+t.scrollLeft,pageY:e.clientY+t.scrollTop,identifier:1/0})},e.getCoords(t)},e.getCoord=function(t){if("ontouchstart"in window){var n=0,r=0;e.getCoord=function(e){var t=e.changedTouches;return t&&t.length?{x:n=t[0].pageX,y:r=t[0].pageY}:{x:n,y:r}}}else e.getCoord=t.pageX!==void 0&&t.pageY!==void 0?function(e){return{x:e.pageX,y:e.pageY}}:function(e){var t=document.documentElement;return e=e||window.event,{x:e.clientX+t.scrollLeft,y:e.clientY+t.scrollTop}};return e.getCoord(t)};var n=function(e,t){var n=parseFloat(e.getPropertyValue(t),10);return isFinite(n)?n:0};return e.getBoundingBox=function(e){(e===window||e===document)&&(e=document.body);var t={},r=e.getBoundingClientRect();t.width=r.width,t.height=r.height,t.x1=r.left,t.y1=r.top,t.scaleX=r.width/e.offsetWidth||1,t.scaleY=r.height/e.offsetHeight||1,t.scrollLeft=0,t.scrollTop=0;var o=window.getComputedStyle(e),i="border-box"===o.getPropertyValue("box-sizing");if(i===!1){var s=n(o,"border-left-width"),a=n(o,"border-right-width"),u=n(o,"border-bottom-width"),v=n(o,"border-top-width");t.border=[s,a,v,u],t.x1+=s,t.y1+=v,t.width-=a+s,t.height-=u+v}t.x2=t.x1+t.width,t.y2=t.y1+t.height;for(var d=o.getPropertyValue("position"),c="fixed"===d?e:e.parentNode;null!==c&&c!==document.body&&void 0!==c.scrollTop;){var o=window.getComputedStyle(c),d=o.getPropertyValue("position");if("absolute"===d);else{if("fixed"===d){t.scrollTop-=c.parentNode.scrollTop,t.scrollLeft-=c.parentNode.scrollLeft;break}t.scrollLeft+=c.scrollLeft,t.scrollTop+=c.scrollTop}c=c.parentNode}return t.scrollBodyLeft=void 0!==window.pageXOffset?window.pageXOffset:(document.documentElement||document.body.parentNode||document.body).scrollLeft,t.scrollBodyTop=void 0!==window.pageYOffset?window.pageYOffset:(document.documentElement||document.body.parentNode||document.body).scrollTop,t.scrollLeft-=t.scrollBodyLeft,t.scrollTop-=t.scrollBodyTop,t},function(){var t,n=navigator.userAgent.toLowerCase(),r=-1!==n.indexOf("macintosh");t=r&&-1!==n.indexOf("khtml")?{91:!0,93:!0}:r&&-1!==n.indexOf("firefox")?{224:!0}:{17:!0},(e.metaTrackerReset=function(){eventjs.fnKey=e.fnKey=!1,eventjs.metaKey=e.metaKey=!1,eventjs.escKey=e.escKey=!1,eventjs.ctrlKey=e.ctrlKey=!1,eventjs.shiftKey=e.shiftKey=!1,eventjs.altKey=e.altKey=!1})(),e.metaTracker=function(n){var r="keydown"===n.type;27===n.keyCode&&(eventjs.escKey=e.escKey=r),t[n.keyCode]&&(eventjs.metaKey=e.metaKey=r),eventjs.ctrlKey=e.ctrlKey=n.ctrlKey,eventjs.shiftKey=e.shiftKey=n.shiftKey,eventjs.altKey=e.altKey=n.altKey}}(),e}(eventjs.proxy),eventjs===void 0)var eventjs={};if(eventjs.MutationObserver=function(){var e=window.MutationObserver||window.WebKitMutationObserver||window.MozMutationObserver,t=!e&&function(){var e=document.createElement("p"),t=!1,n=function(){t=!0};if(e.addEventListener)e.addEventListener("DOMAttrModified",n,!1);else{if(!e.attachEvent)return!1;e.attachEvent("onDOMAttrModified",n)}return e.setAttribute("id","target"),t}();return function(n,r){if(e){var o={subtree:!1,attributes:!0},i=new e(function(e){e.forEach(function(e){r.call(e.target,e.attributeName)})});i.observe(n,o)}else t?eventjs.add(n,"DOMAttrModified",function(e){r.call(n,e.attrName)}):"onpropertychange"in document.body&&eventjs.add(n,"propertychange",function(){r.call(n,window.event.propertyName)})}}(),eventjs===void 0)var eventjs={};if(eventjs.proxy===void 0&&(eventjs.proxy={}),eventjs.proxy=function(e){"use strict";return e.click=function(t){t.gesture=t.gesture||"click",t.maxFingers=t.maxFingers||t.fingers||1,t.onPointerDown=function(r){e.pointerStart(r,n,t)&&eventjs.add(t.target,"mouseup",t.onPointerUp)},t.onPointerUp=function(r){if(e.pointerEnd(r,n,t)){eventjs.remove(t.target,"mouseup",t.onPointerUp);var o=r.changedTouches||e.getCoords(r),i=o[0],s=t.bbox,a=e.getBoundingBox(t.target),u=i.pageY-a.scrollBodyTop,v=i.pageX-a.scrollBodyLeft;if(v>s.x1&&u>s.y1&&s.x2>v&&s.y2>u&&s.scrollTop===a.scrollTop){for(var d in t.tracker)break;var c=t.tracker[d];n.x=c.start.x,n.y=c.start.y,t.listener(r,n)}}};var n=e.pointerSetup(t);return n.state="click",eventjs.add(t.target,"mousedown",t.onPointerDown),n},eventjs.Gesture=eventjs.Gesture||{},eventjs.Gesture._gestureHandlers=eventjs.Gesture._gestureHandlers||{},eventjs.Gesture._gestureHandlers.click=e.click,e}(eventjs.proxy),eventjs===void 0)var eventjs={};if(eventjs.proxy===void 0&&(eventjs.proxy={}),eventjs.proxy=function(e){"use strict";return e.dbltap=e.dblclick=function(t){t.gesture=t.gesture||"dbltap",t.maxFingers=t.maxFingers||t.fingers||1;var n,r,o,i,s,a=700;t.onPointerDown=function(v){var d=v.changedTouches||e.getCoords(v);n&&!r?(s=d[0],r=(new Date).getTime()-n):(i=d[0],n=(new Date).getTime(),r=0,clearTimeout(o),o=setTimeout(function(){n=0},a)),e.pointerStart(v,u,t)&&(eventjs.add(t.target,"mousemove",t.onPointerMove).listener(v),eventjs.add(t.target,"mouseup",t.onPointerUp))},t.onPointerMove=function(a){if(n&&!r){var u=a.changedTouches||e.getCoords(a);s=u[0]}var v=t.bbox,d=s.pageX-v.x1,c=s.pageY-v.y1;d>0&&v.width>d&&c>0&&v.height>c&&25>=Math.abs(s.pageX-i.pageX)&&25>=Math.abs(s.pageY-i.pageY)||(eventjs.remove(t.target,"mousemove",t.onPointerMove),clearTimeout(o),n=r=0)},t.onPointerUp=function(i){if(e.pointerEnd(i,u,t)&&(eventjs.remove(t.target,"mousemove",t.onPointerMove),eventjs.remove(t.target,"mouseup",t.onPointerUp)),n&&r){if(a>=r){u.state=t.gesture;for(var s in t.tracker)break;var v=t.tracker[s];u.x=v.start.x,u.y=v.start.y,t.listener(i,u)}clearTimeout(o),n=r=0}};var u=e.pointerSetup(t);return u.state="dblclick",eventjs.add(t.target,"mousedown",t.onPointerDown),u},eventjs.Gesture=eventjs.Gesture||{},eventjs.Gesture._gestureHandlers=eventjs.Gesture._gestureHandlers||{},eventjs.Gesture._gestureHandlers.dbltap=e.dbltap,eventjs.Gesture._gestureHandlers.dblclick=e.dblclick,e}(eventjs.proxy),eventjs===void 0)var eventjs={};if(eventjs.proxy===void 0&&(eventjs.proxy={}),eventjs.proxy=function(e){"use strict";return e.dragElement=function(t,n){e.drag({event:n,target:t,position:"move",listener:function(e,n){t.style.left=n.x+"px",t.style.top=n.y+"px",eventjs.prevent(e)}})},e.drag=function(t){t.gesture="drag",t.onPointerDown=function(r){e.pointerStart(r,n,t)&&(t.monitor||(eventjs.add(t.doc,"mousemove",t.onPointerMove),eventjs.add(t.doc,"mouseup",t.onPointerUp))),t.onPointerMove(r,"down")},t.onPointerMove=function(r,o){if(!t.tracker)return t.onPointerDown(r);t.bbox;for(var i=r.changedTouches||e.getCoords(r),s=i.length,a=0;s>a;a++){var u=i[a],v=u.identifier||1/0,d=t.tracker[v];d&&(d.pageX=u.pageX,d.pageY=u.pageY,n.state=o||"move",n.identifier=v,n.start=d.start,n.fingers=t.fingers,"differenceFromLast"===t.position?(n.x=d.pageX-d.offsetX,n.y=d.pageY-d.offsetY,d.offsetX=d.pageX,d.offsetY=d.pageY):(n.x=d.pageX-d.offsetX,n.y=d.pageY-d.offsetY),t.listener(r,n))}},t.onPointerUp=function(r){e.pointerEnd(r,n,t,t.onPointerMove)&&(t.monitor||(eventjs.remove(t.doc,"mousemove",t.onPointerMove),eventjs.remove(t.doc,"mouseup",t.onPointerUp)))};var n=e.pointerSetup(t);return t.event?t.onPointerDown(t.event):(eventjs.add(t.target,"mousedown",t.onPointerDown),t.monitor&&(eventjs.add(t.doc,"mousemove",t.onPointerMove),eventjs.add(t.doc,"mouseup",t.onPointerUp))),n},eventjs.Gesture=eventjs.Gesture||{},eventjs.Gesture._gestureHandlers=eventjs.Gesture._gestureHandlers||{},eventjs.Gesture._gestureHandlers.drag=e.drag,e}(eventjs.proxy),eventjs===void 0)var eventjs={};if(eventjs.proxy===void 0&&(eventjs.proxy={}),eventjs.proxy=function(e){"use strict";var t=Math.PI/180,n=function(e,t){var n=0,r=0,o=0;for(var i in t){var s=t[i];s.up||(n+=s.move.x,r+=s.move.y,o++)}return e.x=n/=o,e.y=r/=o,e};return e.gesture=function(r){r.gesture=r.gesture||"gesture",r.minFingers=r.minFingers||r.fingers||2,r.onPointerDown=function(t){var i=r.fingers;if(e.pointerStart(t,o,r)&&(eventjs.add(r.doc,"mousemove",r.onPointerMove),eventjs.add(r.doc,"mouseup",r.onPointerUp)),r.fingers===r.minFingers&&i!==r.fingers){o.fingers=r.minFingers,o.scale=1,o.rotation=0,o.state="start";var s="";for(var a in r.tracker)s+=a;o.identifier=parseInt(s),n(o,r.tracker),r.listener(t,o)}},r.onPointerMove=function(i){for(var s=r.bbox,a=r.tracker,u=i.changedTouches||e.getCoords(i),v=u.length,d=0;v>d;d++){var c=u[d],f=c.identifier||1/0,l=a[f];l&&(l.move.x=c.pageX-s.x1,l.move.y=c.pageY-s.y1)}if(!(r.fingers0?x:-x,c.DEG2!==void 0&&(x>0?c.rotation+=c.DEG1-c.DEG2:c.rotation-=c.DEG1-c.DEG2,g+=c.rotation),u.push(c.move)}}o.touches=u,o.fingers=r.fingers,o.scale=p/r.fingers,o.rotation=g/r.fingers,o.state="change",r.listener(i,o)}},r.onPointerUp=function(t){var n=r.fingers;e.pointerEnd(t,o,r)&&(eventjs.remove(r.doc,"mousemove",r.onPointerMove),eventjs.remove(r.doc,"mouseup",r.onPointerUp)),n===r.minFingers&&r.fingersp;p++){var m=f[p],j=t.acceleration[m],y=u[m],h=Math.abs(j);if(!(r>l-s)&&h>n){var w=l*j/h,x=Math.abs(w+y.value);y.value&&o>x?(y.value=w,y.count++,y.count===i&&(e.listener(v,t),s=l,y.value=0,y.count=0)):(y.value=w,y.count=1)}}};return window.addEventListener?(window.addEventListener("devicemotion",v,!1),t):void 0},eventjs.Gesture=eventjs.Gesture||{},eventjs.Gesture._gestureHandlers=eventjs.Gesture._gestureHandlers||{},eventjs.Gesture._gestureHandlers.shake=e.shake,e}(eventjs.proxy),eventjs===void 0)var eventjs={};if(eventjs.proxy===void 0&&(eventjs.proxy={}),eventjs.proxy=function(e){"use strict";var t=Math.PI/180;return e.swipe=function(n){n.snap=n.snap||90,n.threshold=n.threshold||1,n.gesture=n.gesture||"swipe",n.onPointerDown=function(t){e.pointerStart(t,r,n)&&(eventjs.add(n.doc,"mousemove",n.onPointerMove).listener(t),eventjs.add(n.doc,"mouseup",n.onPointerUp))},n.onPointerMove=function(t){for(var r=t.changedTouches||e.getCoords(t),o=r.length,i=0;o>i;i++){var s=r[i],a=s.identifier||1/0,u=n.tracker[a];u&&(u.move.x=s.pageX,u.move.y=s.pageY,u.moveTime=(new Date).getTime())}},n.onPointerUp=function(o){if(e.pointerEnd(o,r,n)){eventjs.remove(n.doc,"mousemove",n.onPointerMove),eventjs.remove(n.doc,"mouseup",n.onPointerUp);var i,s,a,u,v={x:0,y:0},d=0,c=0,f=0;for(var l in n.tracker){var p=n.tracker[l],g=p.move.x-p.start.x,m=p.move.y-p.start.y;d+=p.move.x,c+=p.move.y,v.x+=p.start.x,v.y+=p.start.y,f++;var j=Math.sqrt(g*g+m*m),y=p.moveTime-p.startTime,u=Math.atan2(g,m)/t+180,s=y?j/y:0;if(a===void 0)a=u,i=s;else{if(!(20>=Math.abs(u-a)))return;a=(a+u)/2,i=(i+s)/2}}var h=n.gestureFingers;h>=n.minFingers&&n.maxFingers>=h&&i>n.threshold&&(v.x/=f,v.y/=f,r.start=v,r.x=d/f,r.y=c/f,r.angle=-(((a/n.snap+.5>>0)*n.snap||360)-360),r.velocity=i,r.fingers=h,r.state="swipe",n.listener(o,r))}};var r=e.pointerSetup(n);return eventjs.add(n.target,"mousedown",n.onPointerDown),r},eventjs.Gesture=eventjs.Gesture||{},eventjs.Gesture._gestureHandlers=eventjs.Gesture._gestureHandlers||{},eventjs.Gesture._gestureHandlers.swipe=e.swipe,e}(eventjs.proxy),eventjs===void 0)var eventjs={};if(eventjs.proxy===void 0&&(eventjs.proxy={}),eventjs.proxy=function(e){"use strict";return e.longpress=function(t){return t.gesture="longpress",e.tap(t)},e.tap=function(t){t.delay=t.delay||500,t.timeout=t.timeout||250,t.driftDeviance=t.driftDeviance||10,t.gesture=t.gesture||"tap";var n,r;t.onPointerDown=function(i){if(e.pointerStart(i,o,t)){if(n=(new Date).getTime(),eventjs.add(t.doc,"mousemove",t.onPointerMove).listener(i),eventjs.add(t.doc,"mouseup",t.onPointerUp),"longpress"!==t.gesture)return;r=setTimeout(function(){if(!(i.cancelBubble&&++i.cancelBubbleCount>1)){var e=0;for(var n in t.tracker){var r=t.tracker[n];if(r.end===!0)return;if(t.cancel)return;e++}e>=t.minFingers&&t.maxFingers>=e&&(o.state="start",o.fingers=e,o.x=r.start.x,o.y=r.start.y,t.listener(i,o))}},t.delay)}},t.onPointerMove=function(n){for(var r=t.bbox,o=n.changedTouches||e.getCoords(n),i=o.length,s=0;i>s;s++){var a=o[s],u=a.identifier||1/0,v=t.tracker[u];if(v){var d=a.pageX-r.x1,c=a.pageY-r.y1,f=d-v.start.x,l=c-v.start.y,p=Math.sqrt(f*f+l*l);if(!(d>0&&r.width>d&&c>0&&r.height>c&&t.driftDeviance>=p))return eventjs.remove(t.doc,"mousemove",t.onPointerMove),t.cancel=!0,void 0}}},t.onPointerUp=function(i){if(e.pointerEnd(i,o,t)){if(clearTimeout(r),eventjs.remove(t.doc,"mousemove",t.onPointerMove),eventjs.remove(t.doc,"mouseup",t.onPointerUp),i.cancelBubble&&++i.cancelBubbleCount>1)return;if("longpress"===t.gesture)return"start"===o.state&&(o.state="end",t.listener(i,o)),void 0;if(t.cancel)return;if((new Date).getTime()-n>t.timeout)return;var s=t.gestureFingers;s>=t.minFingers&&t.maxFingers>=s&&(o.state="tap",o.fingers=t.gestureFingers,t.listener(i,o))}};var o=e.pointerSetup(t);return eventjs.add(t.target,"mousedown",t.onPointerDown),o},eventjs.Gesture=eventjs.Gesture||{},eventjs.Gesture._gestureHandlers=eventjs.Gesture._gestureHandlers||{},eventjs.Gesture._gestureHandlers.tap=e.tap,eventjs.Gesture._gestureHandlers.longpress=e.longpress,e}(eventjs.proxy),eventjs===void 0)var eventjs={};eventjs.proxy===void 0&&(eventjs.proxy={}),eventjs.proxy=function(e){"use strict";return e.wheelPreventElasticBounce=function(e){e&&("string"==typeof e&&(e=document.querySelector(e)),eventjs.add(e,"wheel",function(e,t){t.preventElasticBounce(),eventjs.stop(e)}))},e.wheel=function(e){var t,n=e.timeout||150,r=0,o={gesture:"wheel",state:"start",wheelDelta:0,target:e.target,listener:e.listener,preventElasticBounce:function(e){var t=this.target,n=t.scrollTop,r=n+t.offsetHeight,o=t.scrollHeight;r===o&&0>=this.wheelDelta?eventjs.cancel(e):0===n&&this.wheelDelta>=0&&eventjs.cancel(e),eventjs.stop(e)},add:function(){e.target[s](u,i,!1)},remove:function(){e.target[a](u,i,!1)}},i=function(i){i=i||window.event,o.state=r++?"change":"start",o.wheelDelta=i.detail?-20*i.detail:i.wheelDelta,e.listener(i,o),clearTimeout(t),t=setTimeout(function(){r=0,o.state="end",o.wheelDelta=0,e.listener(i,o)},n)},s=document.addEventListener?"addEventListener":"attachEvent",a=document.removeEventListener?"removeEventListener":"detachEvent",u=eventjs.getEventSupport("mousewheel")?"mousewheel":"DOMMouseScroll";return e.target[s](u,i,!1),o},eventjs.Gesture=eventjs.Gesture||{},eventjs.Gesture._gestureHandlers=eventjs.Gesture._gestureHandlers||{},eventjs.Gesture._gestureHandlers.wheel=e.wheel,e}(eventjs.proxy); -------------------------------------------------------------------------------- /com.imobicloud.html/assets/webview/html/js/libs/fastclick.jsss: -------------------------------------------------------------------------------- 1 | ;(function () { 2 | 'use strict'; 3 | 4 | /** 5 | * @preserve FastClick: polyfill to remove click delays on browsers with touch UIs. 6 | * 7 | * @codingstandard ftlabs-jsv2 8 | * @copyright The Financial Times Limited [All Rights Reserved] 9 | * @license MIT License (see LICENSE.txt) 10 | */ 11 | 12 | /*jslint browser:true, node:true*/ 13 | /*global define, Event, Node*/ 14 | 15 | 16 | /** 17 | * Instantiate fast-clicking listeners on the specified layer. 18 | * 19 | * @constructor 20 | * @param {Element} layer The layer to listen on 21 | * @param {Object} [options={}] The options to override the defaults 22 | */ 23 | function FastClick(layer, options) { 24 | var oldOnClick; 25 | 26 | options = options || {}; 27 | 28 | /** 29 | * Whether a click is currently being tracked. 30 | * 31 | * @type boolean 32 | */ 33 | this.trackingClick = false; 34 | 35 | 36 | /** 37 | * Timestamp for when click tracking started. 38 | * 39 | * @type number 40 | */ 41 | this.trackingClickStart = 0; 42 | 43 | 44 | /** 45 | * The element being tracked for a click. 46 | * 47 | * @type EventTarget 48 | */ 49 | this.targetElement = null; 50 | 51 | 52 | /** 53 | * X-coordinate of touch start event. 54 | * 55 | * @type number 56 | */ 57 | this.touchStartX = 0; 58 | 59 | 60 | /** 61 | * Y-coordinate of touch start event. 62 | * 63 | * @type number 64 | */ 65 | this.touchStartY = 0; 66 | 67 | 68 | /** 69 | * ID of the last touch, retrieved from Touch.identifier. 70 | * 71 | * @type number 72 | */ 73 | this.lastTouchIdentifier = 0; 74 | 75 | 76 | /** 77 | * Touchmove boundary, beyond which a click will be cancelled. 78 | * 79 | * @type number 80 | */ 81 | this.touchBoundary = options.touchBoundary || 10; 82 | 83 | 84 | /** 85 | * The FastClick layer. 86 | * 87 | * @type Element 88 | */ 89 | this.layer = layer; 90 | 91 | /** 92 | * The minimum time between tap(touchstart and touchend) events 93 | * 94 | * @type number 95 | */ 96 | this.tapDelay = options.tapDelay || 200; 97 | 98 | /** 99 | * The maximum time for a tap 100 | * 101 | * @type number 102 | */ 103 | this.tapTimeout = options.tapTimeout || 700; 104 | 105 | if (FastClick.notNeeded(layer)) { 106 | return; 107 | } 108 | 109 | // Some old versions of Android don't have Function.prototype.bind 110 | function bind(method, context) { 111 | return function() { return method.apply(context, arguments); }; 112 | } 113 | 114 | 115 | var methods = ['onMouse', 'onClick', 'onTouchStart', 'onTouchMove', 'onTouchEnd', 'onTouchCancel']; 116 | var context = this; 117 | for (var i = 0, l = methods.length; i < l; i++) { 118 | context[methods[i]] = bind(context[methods[i]], context); 119 | } 120 | 121 | // Set up event handlers as required 122 | if (deviceIsAndroid) { 123 | layer.addEventListener('mouseover', this.onMouse, true); 124 | layer.addEventListener('mousedown', this.onMouse, true); 125 | layer.addEventListener('mouseup', this.onMouse, true); 126 | } 127 | 128 | layer.addEventListener('click', this.onClick, true); 129 | layer.addEventListener('touchstart', this.onTouchStart, false); 130 | layer.addEventListener('touchmove', this.onTouchMove, false); 131 | layer.addEventListener('touchend', this.onTouchEnd, false); 132 | layer.addEventListener('touchcancel', this.onTouchCancel, false); 133 | 134 | // Hack is required for browsers that don't support Event#stopImmediatePropagation (e.g. Android 2) 135 | // which is how FastClick normally stops click events bubbling to callbacks registered on the FastClick 136 | // layer when they are cancelled. 137 | if (!Event.prototype.stopImmediatePropagation) { 138 | layer.removeEventListener = function(type, callback, capture) { 139 | var rmv = Node.prototype.removeEventListener; 140 | if (type === 'click') { 141 | rmv.call(layer, type, callback.hijacked || callback, capture); 142 | } else { 143 | rmv.call(layer, type, callback, capture); 144 | } 145 | }; 146 | 147 | layer.addEventListener = function(type, callback, capture) { 148 | var adv = Node.prototype.addEventListener; 149 | if (type === 'click') { 150 | adv.call(layer, type, callback.hijacked || (callback.hijacked = function(event) { 151 | if (!event.propagationStopped) { 152 | callback(event); 153 | } 154 | }), capture); 155 | } else { 156 | adv.call(layer, type, callback, capture); 157 | } 158 | }; 159 | } 160 | 161 | // If a handler is already declared in the element's onclick attribute, it will be fired before 162 | // FastClick's onClick handler. Fix this by pulling out the user-defined handler function and 163 | // adding it as listener. 164 | if (typeof layer.onclick === 'function') { 165 | 166 | // Android browser on at least 3.2 requires a new reference to the function in layer.onclick 167 | // - the old one won't work if passed to addEventListener directly. 168 | oldOnClick = layer.onclick; 169 | layer.addEventListener('click', function(event) { 170 | oldOnClick(event); 171 | }, false); 172 | layer.onclick = null; 173 | } 174 | } 175 | 176 | /** 177 | * Windows Phone 8.1 fakes user agent string to look like Android and iPhone. 178 | * 179 | * @type boolean 180 | */ 181 | var deviceIsWindowsPhone = navigator.userAgent.indexOf("Windows Phone") >= 0; 182 | 183 | /** 184 | * Android requires exceptions. 185 | * 186 | * @type boolean 187 | */ 188 | var deviceIsAndroid = navigator.userAgent.indexOf('Android') > 0 && !deviceIsWindowsPhone; 189 | 190 | 191 | /** 192 | * iOS requires exceptions. 193 | * 194 | * @type boolean 195 | */ 196 | var deviceIsIOS = /iP(ad|hone|od)/.test(navigator.userAgent) && !deviceIsWindowsPhone; 197 | 198 | 199 | /** 200 | * iOS 4 requires an exception for select elements. 201 | * 202 | * @type boolean 203 | */ 204 | var deviceIsIOS4 = deviceIsIOS && (/OS 4_\d(_\d)?/).test(navigator.userAgent); 205 | 206 | 207 | /** 208 | * iOS 6.0(+?) requires the target element to be manually derived 209 | * 210 | * @type boolean 211 | */ 212 | var deviceIsIOSWithBadTarget = deviceIsIOS && (/OS ([6-9]|\d{2})_\d/).test(navigator.userAgent); 213 | 214 | /** 215 | * BlackBerry requires exceptions. 216 | * 217 | * @type boolean 218 | */ 219 | var deviceIsBlackBerry10 = navigator.userAgent.indexOf('BB10') > 0; 220 | 221 | /** 222 | * Determine whether a given element requires a native click. 223 | * 224 | * @param {EventTarget|Element} target Target DOM element 225 | * @returns {boolean} Returns true if the element needs a native click 226 | */ 227 | FastClick.prototype.needsClick = function(target) { 228 | switch (target.nodeName.toLowerCase()) { 229 | 230 | // Don't send a synthetic click to disabled inputs (issue #62) 231 | case 'button': 232 | case 'select': 233 | case 'textarea': 234 | if (target.disabled) { 235 | return true; 236 | } 237 | 238 | break; 239 | case 'input': 240 | 241 | // File inputs need real clicks on iOS 6 due to a browser bug (issue #68) 242 | if ((deviceIsIOS && target.type === 'file') || target.disabled) { 243 | return true; 244 | } 245 | 246 | break; 247 | case 'label': 248 | case 'iframe': // iOS8 homescreen apps can prevent events bubbling into frames 249 | case 'video': 250 | return true; 251 | } 252 | 253 | return (/\bneedsclick\b/).test(target.className); 254 | }; 255 | 256 | 257 | /** 258 | * Determine whether a given element requires a call to focus to simulate click into element. 259 | * 260 | * @param {EventTarget|Element} target Target DOM element 261 | * @returns {boolean} Returns true if the element requires a call to focus to simulate native click. 262 | */ 263 | FastClick.prototype.needsFocus = function(target) { 264 | switch (target.nodeName.toLowerCase()) { 265 | case 'textarea': 266 | return true; 267 | case 'select': 268 | return !deviceIsAndroid; 269 | case 'input': 270 | switch (target.type) { 271 | case 'button': 272 | case 'checkbox': 273 | case 'file': 274 | case 'image': 275 | case 'radio': 276 | case 'submit': 277 | return false; 278 | } 279 | 280 | // No point in attempting to focus disabled inputs 281 | return !target.disabled && !target.readOnly; 282 | default: 283 | return (/\bneedsfocus\b/).test(target.className); 284 | } 285 | }; 286 | 287 | 288 | /** 289 | * Send a click event to the specified element. 290 | * 291 | * @param {EventTarget|Element} targetElement 292 | * @param {Event} event 293 | */ 294 | FastClick.prototype.sendClick = function(targetElement, event) { 295 | var clickEvent, touch; 296 | 297 | // On some Android devices activeElement needs to be blurred otherwise the synthetic click will have no effect (#24) 298 | if (document.activeElement && document.activeElement !== targetElement) { 299 | document.activeElement.blur(); 300 | } 301 | 302 | touch = event.changedTouches[0]; 303 | 304 | // Synthesise a click event, with an extra attribute so it can be tracked 305 | clickEvent = document.createEvent('MouseEvents'); 306 | clickEvent.initMouseEvent(this.determineEventType(targetElement), true, true, window, 1, touch.screenX, touch.screenY, touch.clientX, touch.clientY, false, false, false, false, 0, null); 307 | clickEvent.forwardedTouchEvent = true; 308 | targetElement.dispatchEvent(clickEvent); 309 | }; 310 | 311 | FastClick.prototype.determineEventType = function(targetElement) { 312 | 313 | //Issue #159: Android Chrome Select Box does not open with a synthetic click event 314 | if (deviceIsAndroid && targetElement.tagName.toLowerCase() === 'select') { 315 | return 'mousedown'; 316 | } 317 | 318 | return 'click'; 319 | }; 320 | 321 | 322 | /** 323 | * @param {EventTarget|Element} targetElement 324 | */ 325 | FastClick.prototype.focus = function(targetElement) { 326 | var length; 327 | 328 | // Issue #160: on iOS 7, some input elements (e.g. date datetime month) throw a vague TypeError on setSelectionRange. These elements don't have an integer value for the selectionStart and selectionEnd properties, but unfortunately that can't be used for detection because accessing the properties also throws a TypeError. Just check the type instead. Filed as Apple bug #15122724. 329 | if (deviceIsIOS && targetElement.setSelectionRange && targetElement.type.indexOf('date') !== 0 && targetElement.type !== 'time' && targetElement.type !== 'month') { 330 | length = targetElement.value.length; 331 | targetElement.setSelectionRange(length, length); 332 | } else { 333 | targetElement.focus(); 334 | } 335 | }; 336 | 337 | 338 | /** 339 | * Check whether the given target element is a child of a scrollable layer and if so, set a flag on it. 340 | * 341 | * @param {EventTarget|Element} targetElement 342 | */ 343 | FastClick.prototype.updateScrollParent = function(targetElement) { 344 | var scrollParent, parentElement; 345 | 346 | scrollParent = targetElement.fastClickScrollParent; 347 | 348 | // Attempt to discover whether the target element is contained within a scrollable layer. Re-check if the 349 | // target element was moved to another parent. 350 | if (!scrollParent || !scrollParent.contains(targetElement)) { 351 | parentElement = targetElement; 352 | do { 353 | if (parentElement.scrollHeight > parentElement.offsetHeight) { 354 | scrollParent = parentElement; 355 | targetElement.fastClickScrollParent = parentElement; 356 | break; 357 | } 358 | 359 | parentElement = parentElement.parentElement; 360 | } while (parentElement); 361 | } 362 | 363 | // Always update the scroll top tracker if possible. 364 | if (scrollParent) { 365 | scrollParent.fastClickLastScrollTop = scrollParent.scrollTop; 366 | } 367 | }; 368 | 369 | 370 | /** 371 | * @param {EventTarget} targetElement 372 | * @returns {Element|EventTarget} 373 | */ 374 | FastClick.prototype.getTargetElementFromEventTarget = function(eventTarget) { 375 | 376 | // On some older browsers (notably Safari on iOS 4.1 - see issue #56) the event target may be a text node. 377 | if (eventTarget.nodeType === Node.TEXT_NODE) { 378 | return eventTarget.parentNode; 379 | } 380 | 381 | return eventTarget; 382 | }; 383 | 384 | 385 | /** 386 | * On touch start, record the position and scroll offset. 387 | * 388 | * @param {Event} event 389 | * @returns {boolean} 390 | */ 391 | FastClick.prototype.onTouchStart = function(event) { 392 | var targetElement, touch, selection; 393 | 394 | // Ignore multiple touches, otherwise pinch-to-zoom is prevented if both fingers are on the FastClick element (issue #111). 395 | if (event.targetTouches.length > 1) { 396 | return true; 397 | } 398 | 399 | targetElement = this.getTargetElementFromEventTarget(event.target); 400 | touch = event.targetTouches[0]; 401 | 402 | if (deviceIsIOS) { 403 | 404 | // Only trusted events will deselect text on iOS (issue #49) 405 | selection = window.getSelection(); 406 | if (selection.rangeCount && !selection.isCollapsed) { 407 | return true; 408 | } 409 | 410 | if (!deviceIsIOS4) { 411 | 412 | // Weird things happen on iOS when an alert or confirm dialog is opened from a click event callback (issue #23): 413 | // when the user next taps anywhere else on the page, new touchstart and touchend events are dispatched 414 | // with the same identifier as the touch event that previously triggered the click that triggered the alert. 415 | // Sadly, there is an issue on iOS 4 that causes some normal touch events to have the same identifier as an 416 | // immediately preceeding touch event (issue #52), so this fix is unavailable on that platform. 417 | // Issue 120: touch.identifier is 0 when Chrome dev tools 'Emulate touch events' is set with an iOS device UA string, 418 | // which causes all touch events to be ignored. As this block only applies to iOS, and iOS identifiers are always long, 419 | // random integers, it's safe to to continue if the identifier is 0 here. 420 | if (touch.identifier && touch.identifier === this.lastTouchIdentifier) { 421 | event.preventDefault(); 422 | return false; 423 | } 424 | 425 | this.lastTouchIdentifier = touch.identifier; 426 | 427 | // If the target element is a child of a scrollable layer (using -webkit-overflow-scrolling: touch) and: 428 | // 1) the user does a fling scroll on the scrollable layer 429 | // 2) the user stops the fling scroll with another tap 430 | // then the event.target of the last 'touchend' event will be the element that was under the user's finger 431 | // when the fling scroll was started, causing FastClick to send a click event to that layer - unless a check 432 | // is made to ensure that a parent layer was not scrolled before sending a synthetic click (issue #42). 433 | this.updateScrollParent(targetElement); 434 | } 435 | } 436 | 437 | this.trackingClick = true; 438 | this.trackingClickStart = event.timeStamp; 439 | this.targetElement = targetElement; 440 | 441 | this.touchStartX = touch.pageX; 442 | this.touchStartY = touch.pageY; 443 | 444 | // Prevent phantom clicks on fast double-tap (issue #36) 445 | if ((event.timeStamp - this.lastClickTime) < this.tapDelay) { 446 | event.preventDefault(); 447 | } 448 | 449 | return true; 450 | }; 451 | 452 | 453 | /** 454 | * Based on a touchmove event object, check whether the touch has moved past a boundary since it started. 455 | * 456 | * @param {Event} event 457 | * @returns {boolean} 458 | */ 459 | FastClick.prototype.touchHasMoved = function(event) { 460 | var touch = event.changedTouches[0], boundary = this.touchBoundary; 461 | 462 | if (Math.abs(touch.pageX - this.touchStartX) > boundary || Math.abs(touch.pageY - this.touchStartY) > boundary) { 463 | return true; 464 | } 465 | 466 | return false; 467 | }; 468 | 469 | 470 | /** 471 | * Update the last position. 472 | * 473 | * @param {Event} event 474 | * @returns {boolean} 475 | */ 476 | FastClick.prototype.onTouchMove = function(event) { 477 | if (!this.trackingClick) { 478 | return true; 479 | } 480 | 481 | // If the touch has moved, cancel the click tracking 482 | if (this.targetElement !== this.getTargetElementFromEventTarget(event.target) || this.touchHasMoved(event)) { 483 | this.trackingClick = false; 484 | this.targetElement = null; 485 | } 486 | 487 | return true; 488 | }; 489 | 490 | 491 | /** 492 | * Attempt to find the labelled control for the given label element. 493 | * 494 | * @param {EventTarget|HTMLLabelElement} labelElement 495 | * @returns {Element|null} 496 | */ 497 | FastClick.prototype.findControl = function(labelElement) { 498 | 499 | // Fast path for newer browsers supporting the HTML5 control attribute 500 | if (labelElement.control !== undefined) { 501 | return labelElement.control; 502 | } 503 | 504 | // All browsers under test that support touch events also support the HTML5 htmlFor attribute 505 | if (labelElement.htmlFor) { 506 | return document.getElementById(labelElement.htmlFor); 507 | } 508 | 509 | // If no for attribute exists, attempt to retrieve the first labellable descendant element 510 | // the list of which is defined here: http://www.w3.org/TR/html5/forms.html#category-label 511 | return labelElement.querySelector('button, input:not([type=hidden]), keygen, meter, output, progress, select, textarea'); 512 | }; 513 | 514 | 515 | /** 516 | * On touch end, determine whether to send a click event at once. 517 | * 518 | * @param {Event} event 519 | * @returns {boolean} 520 | */ 521 | FastClick.prototype.onTouchEnd = function(event) { 522 | var forElement, trackingClickStart, targetTagName, scrollParent, touch, targetElement = this.targetElement; 523 | 524 | if (!this.trackingClick) { 525 | return true; 526 | } 527 | 528 | // Prevent phantom clicks on fast double-tap (issue #36) 529 | if ((event.timeStamp - this.lastClickTime) < this.tapDelay) { 530 | this.cancelNextClick = true; 531 | return true; 532 | } 533 | 534 | if ((event.timeStamp - this.trackingClickStart) > this.tapTimeout) { 535 | return true; 536 | } 537 | 538 | // Reset to prevent wrong click cancel on input (issue #156). 539 | this.cancelNextClick = false; 540 | 541 | this.lastClickTime = event.timeStamp; 542 | 543 | trackingClickStart = this.trackingClickStart; 544 | this.trackingClick = false; 545 | this.trackingClickStart = 0; 546 | 547 | // On some iOS devices, the targetElement supplied with the event is invalid if the layer 548 | // is performing a transition or scroll, and has to be re-detected manually. Note that 549 | // for this to function correctly, it must be called *after* the event target is checked! 550 | // See issue #57; also filed as rdar://13048589 . 551 | if (deviceIsIOSWithBadTarget) { 552 | touch = event.changedTouches[0]; 553 | 554 | // In certain cases arguments of elementFromPoint can be negative, so prevent setting targetElement to null 555 | targetElement = document.elementFromPoint(touch.pageX - window.pageXOffset, touch.pageY - window.pageYOffset) || targetElement; 556 | targetElement.fastClickScrollParent = this.targetElement.fastClickScrollParent; 557 | } 558 | 559 | targetTagName = targetElement.tagName.toLowerCase(); 560 | if (targetTagName === 'label') { 561 | forElement = this.findControl(targetElement); 562 | if (forElement) { 563 | this.focus(targetElement); 564 | if (deviceIsAndroid) { 565 | return false; 566 | } 567 | 568 | targetElement = forElement; 569 | } 570 | } else if (this.needsFocus(targetElement)) { 571 | 572 | // Case 1: If the touch started a while ago (best guess is 100ms based on tests for issue #36) then focus will be triggered anyway. Return early and unset the target element reference so that the subsequent click will be allowed through. 573 | // Case 2: Without this exception for input elements tapped when the document is contained in an iframe, then any inputted text won't be visible even though the value attribute is updated as the user types (issue #37). 574 | if ((event.timeStamp - trackingClickStart) > 100 || (deviceIsIOS && window.top !== window && targetTagName === 'input')) { 575 | this.targetElement = null; 576 | return false; 577 | } 578 | 579 | this.focus(targetElement); 580 | this.sendClick(targetElement, event); 581 | 582 | // Select elements need the event to go through on iOS 4, otherwise the selector menu won't open. 583 | // Also this breaks opening selects when VoiceOver is active on iOS6, iOS7 (and possibly others) 584 | if (!deviceIsIOS || targetTagName !== 'select') { 585 | this.targetElement = null; 586 | event.preventDefault(); 587 | } 588 | 589 | return false; 590 | } 591 | 592 | if (deviceIsIOS && !deviceIsIOS4) { 593 | 594 | // Don't send a synthetic click event if the target element is contained within a parent layer that was scrolled 595 | // and this tap is being used to stop the scrolling (usually initiated by a fling - issue #42). 596 | scrollParent = targetElement.fastClickScrollParent; 597 | if (scrollParent && scrollParent.fastClickLastScrollTop !== scrollParent.scrollTop) { 598 | return true; 599 | } 600 | } 601 | 602 | // Prevent the actual click from going though - unless the target node is marked as requiring 603 | // real clicks or if it is in the whitelist in which case only non-programmatic clicks are permitted. 604 | if (!this.needsClick(targetElement)) { 605 | event.preventDefault(); 606 | this.sendClick(targetElement, event); 607 | } 608 | 609 | return false; 610 | }; 611 | 612 | 613 | /** 614 | * On touch cancel, stop tracking the click. 615 | * 616 | * @returns {void} 617 | */ 618 | FastClick.prototype.onTouchCancel = function() { 619 | this.trackingClick = false; 620 | this.targetElement = null; 621 | }; 622 | 623 | 624 | /** 625 | * Determine mouse events which should be permitted. 626 | * 627 | * @param {Event} event 628 | * @returns {boolean} 629 | */ 630 | FastClick.prototype.onMouse = function(event) { 631 | 632 | // If a target element was never set (because a touch event was never fired) allow the event 633 | if (!this.targetElement) { 634 | return true; 635 | } 636 | 637 | if (event.forwardedTouchEvent) { 638 | return true; 639 | } 640 | 641 | // Programmatically generated events targeting a specific element should be permitted 642 | if (!event.cancelable) { 643 | return true; 644 | } 645 | 646 | // Derive and check the target element to see whether the mouse event needs to be permitted; 647 | // unless explicitly enabled, prevent non-touch click events from triggering actions, 648 | // to prevent ghost/doubleclicks. 649 | if (!this.needsClick(this.targetElement) || this.cancelNextClick) { 650 | 651 | // Prevent any user-added listeners declared on FastClick element from being fired. 652 | if (event.stopImmediatePropagation) { 653 | event.stopImmediatePropagation(); 654 | } else { 655 | 656 | // Part of the hack for browsers that don't support Event#stopImmediatePropagation (e.g. Android 2) 657 | event.propagationStopped = true; 658 | } 659 | 660 | // Cancel the event 661 | event.stopPropagation(); 662 | event.preventDefault(); 663 | 664 | return false; 665 | } 666 | 667 | // If the mouse event is permitted, return true for the action to go through. 668 | return true; 669 | }; 670 | 671 | 672 | /** 673 | * On actual clicks, determine whether this is a touch-generated click, a click action occurring 674 | * naturally after a delay after a touch (which needs to be cancelled to avoid duplication), or 675 | * an actual click which should be permitted. 676 | * 677 | * @param {Event} event 678 | * @returns {boolean} 679 | */ 680 | FastClick.prototype.onClick = function(event) { 681 | var permitted; 682 | 683 | // It's possible for another FastClick-like library delivered with third-party code to fire a click event before FastClick does (issue #44). In that case, set the click-tracking flag back to false and return early. This will cause onTouchEnd to return early. 684 | if (this.trackingClick) { 685 | this.targetElement = null; 686 | this.trackingClick = false; 687 | return true; 688 | } 689 | 690 | // Very odd behaviour on iOS (issue #18): if a submit element is present inside a form and the user hits enter in the iOS simulator or clicks the Go button on the pop-up OS keyboard the a kind of 'fake' click event will be triggered with the submit-type input element as the target. 691 | if (event.target.type === 'submit' && event.detail === 0) { 692 | return true; 693 | } 694 | 695 | permitted = this.onMouse(event); 696 | 697 | // Only unset targetElement if the click is not permitted. This will ensure that the check for !targetElement in onMouse fails and the browser's click doesn't go through. 698 | if (!permitted) { 699 | this.targetElement = null; 700 | } 701 | 702 | // If clicks are permitted, return true for the action to go through. 703 | return permitted; 704 | }; 705 | 706 | 707 | /** 708 | * Remove all FastClick's event listeners. 709 | * 710 | * @returns {void} 711 | */ 712 | FastClick.prototype.destroy = function() { 713 | var layer = this.layer; 714 | 715 | if (deviceIsAndroid) { 716 | layer.removeEventListener('mouseover', this.onMouse, true); 717 | layer.removeEventListener('mousedown', this.onMouse, true); 718 | layer.removeEventListener('mouseup', this.onMouse, true); 719 | } 720 | 721 | layer.removeEventListener('click', this.onClick, true); 722 | layer.removeEventListener('touchstart', this.onTouchStart, false); 723 | layer.removeEventListener('touchmove', this.onTouchMove, false); 724 | layer.removeEventListener('touchend', this.onTouchEnd, false); 725 | layer.removeEventListener('touchcancel', this.onTouchCancel, false); 726 | }; 727 | 728 | 729 | /** 730 | * Check whether FastClick is needed. 731 | * 732 | * @param {Element} layer The layer to listen on 733 | */ 734 | FastClick.notNeeded = function(layer) { 735 | var metaViewport; 736 | var chromeVersion; 737 | var blackberryVersion; 738 | 739 | // Devices that don't support touch don't need FastClick 740 | if (typeof window.ontouchstart === 'undefined') { 741 | return true; 742 | } 743 | 744 | // Chrome version - zero for other browsers 745 | chromeVersion = +(/Chrome\/([0-9]+)/.exec(navigator.userAgent) || [,0])[1]; 746 | 747 | if (chromeVersion) { 748 | 749 | if (deviceIsAndroid) { 750 | metaViewport = document.querySelector('meta[name=viewport]'); 751 | 752 | if (metaViewport) { 753 | // Chrome on Android with user-scalable="no" doesn't need FastClick (issue #89) 754 | if (metaViewport.content.indexOf('user-scalable=no') !== -1) { 755 | return true; 756 | } 757 | // Chrome 32 and above with width=device-width or less don't need FastClick 758 | if (chromeVersion > 31 && document.documentElement.scrollWidth <= window.outerWidth) { 759 | return true; 760 | } 761 | } 762 | 763 | // Chrome desktop doesn't need FastClick (issue #15) 764 | } else { 765 | return true; 766 | } 767 | } 768 | 769 | if (deviceIsBlackBerry10) { 770 | blackberryVersion = navigator.userAgent.match(/Version\/([0-9]*)\.([0-9]*)/); 771 | 772 | // BlackBerry 10.3+ does not require Fastclick library. 773 | // https://github.com/ftlabs/fastclick/issues/251 774 | if (blackberryVersion[1] >= 10 && blackberryVersion[2] >= 3) { 775 | metaViewport = document.querySelector('meta[name=viewport]'); 776 | 777 | if (metaViewport) { 778 | // user-scalable=no eliminates click delay. 779 | if (metaViewport.content.indexOf('user-scalable=no') !== -1) { 780 | return true; 781 | } 782 | // width=device-width (or less than device-width) eliminates click delay. 783 | if (document.documentElement.scrollWidth <= window.outerWidth) { 784 | return true; 785 | } 786 | } 787 | } 788 | } 789 | 790 | // IE10 with -ms-touch-action: none, which disables double-tap-to-zoom (issue #97) 791 | if (layer.style.msTouchAction === 'none') { 792 | return true; 793 | } 794 | 795 | // IE11: prefixed -ms-touch-action is no longer supported and it's recomended to use non-prefixed version 796 | // http://msdn.microsoft.com/en-us/library/windows/apps/Hh767313.aspx 797 | if (layer.style.touchAction === 'none') { 798 | return true; 799 | } 800 | 801 | return false; 802 | }; 803 | 804 | 805 | /** 806 | * Factory method for creating a FastClick object 807 | * 808 | * @param {Element} layer The layer to listen on 809 | * @param {Object} [options={}] The options to override the defaults 810 | */ 811 | FastClick.attach = function(layer, options) { 812 | return new FastClick(layer, options); 813 | }; 814 | 815 | 816 | if (typeof define == 'function' && typeof define.amd == 'object' && define.amd) { 817 | 818 | // AMD. Register as an anonymous module. 819 | define(function() { 820 | return FastClick; 821 | }); 822 | } else if (typeof module !== 'undefined' && module.exports) { 823 | module.exports = FastClick.attach; 824 | module.exports.FastClick = FastClick; 825 | } else { 826 | window.FastClick = FastClick; 827 | } 828 | }()); 829 | -------------------------------------------------------------------------------- /com.imobicloud.html/assets/webview/html/js/libs/jquery.bum-smack-1.2.0.min.jsss: -------------------------------------------------------------------------------- 1 | /*! jquery.bum-smack 08-01-2014 */ 2 | !function(a){"use strict";a.fn.smack=function(b){b=a.extend({},{edge:"bottom"},b),b=a.extend({},{threshold:"top"===b.edge?0:1,deferred:new a.Deferred},b);var c=a(this),d=c.data("bum-smack")||{};return d[b.edge]=b,d.scrollTop=c.scrollTop(),c.data("bum-smack",d),c.off("scroll.smack").on("scroll.smack",function(){var b,e,f,g,h=c.scrollTop(),i=c[0]===window?c.height():c.innerHeight(),j=c[0]===window?a(document).height():c[0].scrollHeight,k=h>d.scrollTop?"down":h=g&&(d.bottom.deferred.resolve(),d.bottom=!1,c.data("bum-smack",d))),"up"===k&&d.top&&(e=-1!==d.top.threshold.toString().toLowerCase().indexOf("px"),f=e?parseInt(d.top.threshold,10):Math.floor(j*d.top.threshold),f>=h&&(d.top.deferred.resolve(),d.top=!1,c.data("bum-smack",d))),d.top||d.bottom||c.off("scroll.smack")}),b.deferred.promise()}}(window.jQuery); -------------------------------------------------------------------------------- /com.imobicloud.html/assets/webview/html/js/libs/jsrender.min.jsss: -------------------------------------------------------------------------------- 1 | /*! JsRender v1.0.0-beta: http://github.com/BorisMoore/jsrender and http://jsviews.com/jsviews 2 | informal pre V1.0 commit counter: 60 */ 3 | (function(n,t,i){"use strict";function et(n,t){for(var i in t.props)wt.test(i)&&(n[i]=t.props[i])}function ot(n){return n}function ir(n){return n}function dt(n){s._dbgMode=n;pt=n?"Unavailable (nested view): use #getIndex()":"";it("dbg",ci.dbg=tt.dbg=n?ir:ot)}function st(n){this.name=(u.link?"JsViews":"JsRender")+" Error";this.message=n||this.name}function f(n,t){for(var i in t)n[i]=t[i];return n}function d(n){return typeof n=="function"}function gt(n,t,i){return(!o.rTag||n)&&(p=n?n.charAt(0):p,w=n?n.charAt(1):w,h=t?t.charAt(0):h,v=t?t.charAt(1):v,nt=i||nt,n="\\"+p+"(\\"+nt+")?\\"+w,t="\\"+h+"\\"+v,y="(?:(?:(\\w+(?=[\\/\\s\\"+h+"]))|(?:(\\w+)?(:)|(>)|!--((?:[^-]|-(?!-))*)--|(\\*)))\\s*((?:[^\\"+h+"]|\\"+h+"(?!\\"+v+"))*?)",o.rTag=y+")",y=new RegExp(n+y+"(\\/)?|(?:\\/(\\w+)))"+t,"g"),yt=new RegExp("<.*>|([^\\\\]|^)[{}]|"+n+".*"+t)),[p,w,h,v,nt]}function rr(n,t){t||(t=n,n=i);var e,f,o,u,r=this,s=!t||t==="root";if(n){if(u=r.type===t?r:i,!u)if(e=r.views,r._.useKey){for(f in e)if(u=e[f].get(n,t))break}else for(f=0,o=e.length;!u&&f0){try{h=u.nodeType>0?u:!yt.test(u)&&t&&t(n.document).find(u)[0]}catch(s){}return h&&(u=e[r=r||h.getAttribute(ft)],u||(r=r||"_"+nr++,h.setAttribute(ft,r),u=e[r]=ii(r,h.innerHTML,f,o)),h=i),u}}var s,h;return u=u||"",s=c(u),o=o||(u.markup?u:{}),o.tmplName=r,f&&(o._parentTmpl=f),!s&&u.markup&&(s=c(u.markup))&&s.fn&&(s.debug!==u.debug||s.allowCode!==u.allowCode)&&(s=s.markup),s!==i?(r&&!f&&(kt[r]=function(){return u.render.apply(u,arguments)}),s.fn||u.fn?s.fn&&(u=r&&r!==s.tmplName?a(o,s):s):(u=ui(s,o),lt(s.replace(pi,"\\$&"),u)),sr(o),u):void 0}function ri(n){function t(t,i){this.tgt=n.getTgt(t,i)}return d(n)&&(n={getTgt:n}),n.baseMap&&(n=f(f({},n.baseMap),n)),n.map=function(n,i){return new t(n,i)},n}function ui(n,t){var i,e=s.wrapMap||{},r=f({markup:n,tmpls:[],links:{},tags:{},bnds:[],_is:"template",render:fi},t);return t.htmlTag||(i=ki.exec(n),r.htmlTag=i?i[1].toLowerCase():""),i=e[r.htmlTag],i&&i!==e.div&&(r.markup=u.trim(r.markup)),r}function cr(n,t){function u(e,s,h){var v,c,l,a;if(e&&typeof e=="object"&&!e.nodeType&&!e.markup&&!e.getTgt){for(l in e)u(l,e[l],s);return r}return s===i&&(s=e,e=i),e&&""+e!==e&&(h=s,s=e,e=i),a=h?h[f]=h[f]||{}:u,c=t.compile,s===null?e&&delete a[e]:(s=c?s=c(e,s,h):s,e&&(a[e]=s)),c&&s&&(s._is=n),s&&(v=o.onStore[n])&&v(e,s,c),s}var f=n+"s";r[f]=u;k[n]=t}function lr(n,t,i){var r=this.jquery&&(this[0]||c('Unknown template: "'+this.selector+'"')),u=r.getAttribute(ft);return fi.call(u?e[u]:e(r),n,t,i)}function ct(n,t,i){if(s._dbgMode)try{return n.fn(t,i,r)}catch(u){return c(u,i)}return n.fn(t,i,r)}function fi(n,t,i,r,f,e){var o=this;return!r&&o.fn._nvw&&!u.isArray(n)?ct(o,n,{tmpl:o}):ei.call(o,n,t,i,r,f,e)}function ei(n,t,r,f,o,s){var y,ut,d,l,nt,tt,it,p,v,rt,w,ft,h,et,c=this,k="";if(!!t===t&&(r=t,t=i),o===!0&&(it=!0,o=0),c.tag?(p=c,c=c.tag,rt=c._,ft=c.tagName,h=rt.tmpl||p.tmpl,et=c.attr&&c.attr!==b,t=a(t,c.ctx),v=p.content,p.props.link===!1&&(t=t||{},t.link=!1),f=f||p.view,n=arguments.length?n:f):h=c,h&&(!f&&n&&n._is==="view"&&(f=n),f&&(v=v||f.content,s=s||f._.onRender,n===f&&(n=f.data),t=a(t,f.ctx)),f&&f.type!=="top"||((t=t||{}).root=n),h.fn||(h=e[h]||e(h)),h)){if(s=(t&&t.link)!==!1&&!et&&s,w=s,s===!0&&(w=i,s=f._.onRender),t=h.helpers?a(h.helpers,t):t,u.isArray(n)&&!r)for(l=it?f:o!==i&&f||new g(t,"array",f,n,h,o,v,s),y=0,ut=n.length;ypt-kt&&(kt=wt.slice(kt,pt+1),at=w+":"+kt+" onerror=''"+h,bt=y[at],bt||(y[at]=!0,y[at]=bt=lt(at,i||r,!0),bt.paths.push({_jsvOb:bt})),bt!==!0&&(s||r).push({_jsvOb:bt}))),o?(o=!st,o?b:'"'):e?(e=!ht,e?b:'"'):(d?(u++,p[u]=pt++,d):"")+(yt?u?"":(c=wt.slice(c,pt),f?(f=a=s=!1,"\b"):"\b,")+c+(c=pt+b.length,r&&t.push(r=[]),"\b"):rt?(u&&l(n),r&&t.pop(),f=nt,a=g,c=pt+b.length,g&&(r=t[f]=[]),nt+":"):nt?nt.split("^").join(".").replace(ai,ni)+(ft?(v[++u]=!0,nt.charAt(0)!=="."&&(p[u]=pt),dt?"":ft):tt):tt?tt:ct?(v[u--]=!1,ct)+(ft?(v[++u]=!0,ft):""):et?(v[u]||l(n),","):k?"":(o=st,e=ht,'"'));l(n)}var f,s,a,e,o,r=t&&t[0],c=0,y=i?i.links:r&&(r.links=r.links||{}),v={},p={0:-1},u=0;return(n+(i?" ":"")).replace(/\)\^/g,").").replace(vi,b)}function vt(n,t,r){var p,f,e,c,g,yt,pt,ni,wt,nt,ot,w,s,st,tt,it,v,ht,y,rt,k,ft,bt,d,kt,dt,ct,h,a,lt,gt,o=0,u="",et={},ti=n.length;for(""+t===t?(y=r?'data-link="'+t.replace(ut," ").slice(1,-1)+'"':t,t=0):(y=t.tmplName||"unnamed",t.allowCode&&(et.allowCode=!0),t.debug&&(et.debug=!0),w=t.bnds,ht=t.tmpls),p=0;p":c+e):(ft&&(rt=ui(bt,et),rt.tmplName=y+"/"+e,vt(ft,rt),ht.push(rt)),dt||(k=e,kt=u,u=""),d=n[p+1],d=d&&d[0]==="else"),lt=a?";\ntry{\nret+=":"\n+",tt="",it="",ct&&(s||gt||c&&c!==b)){if(h="return {"+g+"};",v='c("'+c+'",view,',h=new Function("data,view,j,u"," // "+y+" "+o+" "+e+"\n"+h),h._er=a,tt=v+o+",",it=")",h._tag=e,r)return h;at(h,s);ot=!0}if(u+=ct?(r?(a?"\ntry{\n":"")+"return ":lt)+(ot?(ot=i,nt=wt=!0,v+(s?(w[o-1]=h,o):"{"+g+"}")+")"):e===">"?(pt=!0,"h("+st[0]+")"):(ni=!0,"((v="+st[0]+')!=null?v:"")')):(nt=yt=!0,"\n{view:view,tmpl:"+(ft?ht.length:"0")+","+g+"},"),k&&!d){if(u="["+u.slice(0,-1)+"]",v='t("'+k+'",view,this,',r||s){if(u=new Function("data,view,j,u"," // "+y+" "+o+" "+k+"\nreturn "+u+";"),u._er=a,u._tag=e,s&&at(w[o-1]=u,s),r)return u;tt=v+o+",undefined,";it=")"}u=kt+lt+v+(o||u)+")";s=0;k=0}a&&(nt=!0,u+=";\n}catch(e){ret"+(r?"urn ":"+=")+tt+"j._err(e,view,"+a+")"+it+";}\n"+(r?"":"ret=ret"))}u="// "+y+"\nvar v"+(yt?",t=j._tag":"")+(wt?",c=j._cnvt":"")+(pt?",h=j.converters.html":"")+(r?";\n":',ret=""\n')+(et.debug?"debugger;":"")+u+(r?"\n":";\nreturn ret;");try{u=new Function("data,view,j,u",u)}catch(ii){l("Compiled template code:\n\n"+u+'\n: "'+ii.message+'"')}return t&&(t.fn=u),nt||(u._nvw=!0),u}function a(n,t){return n&&n!==t?t?f(f({},t),n):n:t&&f({},t)}function ar(n){return bt[n]||(bt[n]="&#"+n.charCodeAt(0)+";")}function vr(n){var i,t,r=[];if(typeof n=="object")for(i in n)t=n[i],t&&t.toJSON&&!t.toJSON()||d(t)||r.push({key:i,prop:t});return r}function li(n){return n!=null?di.test(n)&&(""+n).replace(gi,ar)||n:""}if((!t||!t.render)&&!n.jsviews){var u,rt,y,yt,pt,p="{",w="{",h="}",v="}",nt="^",ai=/^(!*?)(?:null|true|false|\d[\d.]*|([\w$]+|\.|~([\w$]+)|#(view|([\w$]+))?)([\w$.^]*?)(?:[.[^]([\w$]+)\]?)?)$/g,vi=/(\()(?=\s*\()|(?:([([])\s*)?(?:(\^?)(!*?[#~]?[\w$.^]+)?\s*((\+\+|--)|\+|-|&&|\|\||===|!==|==|!=|<=|>=|[<>%*:?\/]|(=))\s*|(!*?[#~]?[\w$.^]+)([([])?)|(,\s*)|(\(?)\\?(?:(')|("))|(?:\s*(([)\]])(?=\s*\.|\s*\^|\s*$)|[)\]])([([]?))|(\s+)/g,ut=/[ \t]*(\r\n|\n|\r)/g,yi=/\\(['"])/g,pi=/['"\\]/g,wi=/(?:\x08|^)(onerror:)?(?:(~?)(([\w$]+):)?([^\x08]+))\x08(,)?([^\x08]+)/gi,bi=/^if\s/,ki=/<(\w+)[>\s]/,di=/[\x00`><\"'&]/,wt=/^on[A-Z]|^convert(Back)?$/,gi=/[\x00`><"'&]/g,nr=0,tr=0,bt={"&":"&","<":"<",">":">","\x00":"�","'":"'",'"':""","`":"`"},b="html",ft="data-jsv-tmpl",kt={},k={template:{compile:ii},tag:{compile:hr},helper:{},converter:{}},r={jsviews:"v1.0.0-beta",settings:function(n){f(s,n);dt(s._dbgMode);s.jsv&&s.jsv()},sub:{View:g,Err:st,tmplFn:lt,cvt:ht,parse:hi,extend:f,syntaxErr:l,onStore:{},_lnk:ot,_ths:et},map:ri,_cnvt:fr,_tag:or,_err:c};(st.prototype=new Error).constructor=st;ni.depends=function(){return[this.get("item"),"index"]};ti.depends=function(){return["index"]};g.prototype={get:rr,getIndex:ti,getRsc:er,hlp:ur,_is:"view"};for(rt in k)cr(rt,k[rt]);var e=r.templates,tt=r.converters,ci=r.helpers,it=r.tags,o=r.sub,s=r.settings;t?(u=t,u.fn.render=lr,u.observable&&(f(o,u.views.sub),r.map=u.views.map)):(u=n.jsviews={},u.isArray=Array&&Array.isArray||function(n){return Object.prototype.toString.call(n)==="[object Array]"});u.render=kt;u.views=r;u.templates=e=r.templates;s({debugMode:dt,delimiters:gt,onError:function(n,t,r){return t&&(n=r===i?"{Error: "+n+"}":d(r)?r(n,t):r),n==i?"":n},_dbgMode:!0});it({"else":function(){},"if":{render:function(n){var t=this;return t.rendering.done||!n&&(arguments.length||!t.tagCtx.index)?"":(t.rendering.done=!0,t.selected=t.tagCtx.index,t.tagCtx.render(t.tagCtx.view,!0))},onUpdate:function(n,t,i){for(var r,f,u=0;(r=this.tagCtxs[u])&&r.args.length;u++)if(r=r.args[0],f=!r!=!i[u].args[0],!this.convert&&!!r||f)return f;return!1},flow:!0},"for":{render:function(n){var f,t=this,r=t.tagCtx,e="",o=0;return t.rendering.done||((f=!arguments.length)&&(n=r.view.data),n!==i&&(e+=r.render(n,f),o+=u.isArray(n)?n.length:1),(t.rendering.done=o)&&(t.selected=r.index)),e},flow:!0},include:{flow:!0},"*":{render:ot,flow:!0}});it("props",{baseTag:it["for"],dataMap:ri(vr)});tt({html:li,attr:li,url:function(n){return n!=i?encodeURI(""+n):n===null?n:""}});gt()}})(this,this.jQuery); 4 | /* 5 | //# sourceMappingURL=jsrender.min.js.map 6 | */ -------------------------------------------------------------------------------- /com.imobicloud.html/assets/webview/html/js/templates/comment.jsss: -------------------------------------------------------------------------------- 1 | $.templates({ 2 | comment: '\ 3 |
\ 4 | \ 5 | \ 6 | \ 7 |
\ 8 | {{:profile.name}}\ 9 | {{:created_at}}\ 10 |
\ 11 | {{for quotes tmpl="quote" /}}\ 12 | {{if content }}
{{:content}}
{{/if}}\ 13 |
', 14 | quote: '
\ 15 | \ 16 | \ 17 | \ 18 |
\ 19 | {{:profile.name}}\ 20 | View Original\ 21 |
\ 22 |
{{:content}}
\ 23 |
\ 24 |
{{:reply}}
' 25 | }); -------------------------------------------------------------------------------- /com.imobicloud.html/assets/webview/html/js/templates/comments.jsss: -------------------------------------------------------------------------------- 1 | eventjs.add(window, "swipe", onSwipe); 2 | 3 | function loadUI() { 4 | $('#app').html('
'); 5 | $('#app').on('click', UTILS.onClick); 6 | } 7 | 8 | function loadComments(params) { 9 | $('#comments').html( UTILS.render(params) ); 10 | 11 | updateNav(params); 12 | 13 | UTILS.scroll(); 14 | } 15 | 16 | function updateNav(params) { 17 | var html = []; 18 | 19 | html.push(' '); 44 | 45 | $('.nav-container').html( html.join('') ); 46 | $('.nav-container').show(); 47 | } 48 | 49 | function resetComments() { 50 | $('#comments').html(''); 51 | $('.nav-container').hide(); 52 | UTILS.showAI(); 53 | } 54 | 55 | function resizeImage(e) { 56 | if (e.height > 200) { 57 | e.height = 200; 58 | } 59 | } 60 | 61 | function onSwipe(e, self) { 62 | var direction = { 0: 'up', 90: 'right', 180: 'down', 270: 'left' }; 63 | UTILS.fireEvent(e, 'swipe', { direction: direction[self.angle] }); 64 | } -------------------------------------------------------------------------------- /com.imobicloud.html/controllers/widget.js: -------------------------------------------------------------------------------- 1 | var eventName = 'app:' + new Date().getTime(), 2 | cache = [{ 3 | callback: 'UTILS.init', 4 | params: eventName 5 | }], 6 | wvReady = false; 7 | 8 | init(arguments[0]); 9 | 10 | /* 11 | params = { 12 | csss: 'templates/stories,templates/comment', 13 | scripts: 'libs/Event.min,templates/stories,templates/comment,riot/tag templates/todo.tag', 14 | 15 | url: '/webview/html/index.html' 16 | } 17 | * */ 18 | function init(params) { 19 | var html = Ti.Filesystem.getFile( Ti.Filesystem.resourcesDirectory, params.url || '/webview/html/index.html' ).read().toString(), 20 | csss = params.csss ? params.csss.split(',') : [], 21 | scripts = params.scripts ? params.scripts.split(',') : [], 22 | css = [], 23 | script = []; 24 | 25 | csss.unshift( 'index.css' ); 26 | scripts.unshift( 'libs/jquery-2.1.1.min.jsss', 'libs/fastclick.jsss', 'index.jsss' ); 27 | 28 | for(var i=0,ii=csss.length; i '); 30 | } 31 | 32 | for(var i=0,ii=scripts.length; i '); 36 | } else { 37 | // ex: type url inline 38 | // riot/tag templates/todo.tag 39 | // riot/tag templates/todo.tag true 40 | var parts = js.split(' '); 41 | if (!parts[2]) { 42 | script.push(' '); 43 | } else { 44 | script.push(' '); 45 | } 46 | } 47 | } 48 | 49 | $.container.html = html 50 | .replace('', css.join('\n\t')) 51 | .replace('', script.join('\n\t')); 52 | 53 | // 54 | 55 | Ti.App.addEventListener(eventName, fireEvent); 56 | 57 | Ti.API.info('com.imobicloud.html:load ' + eventName); 58 | } 59 | 60 | exports.unload = function() { 61 | Ti.App.removeEventListener(eventName, fireEvent); 62 | 63 | // if (OS_ANDROID) { 64 | // $.container.release(); 65 | // } 66 | 67 | Ti.API.info('com.imobicloud.html:unload ' + eventName); 68 | }; 69 | 70 | /* 71 | params = { 72 | callback: '', // name of the function you want to run 73 | params: {} // params for that function 74 | } 75 | * */ 76 | exports.run = function(params) { 77 | cache.push( params ); 78 | checkCondition(); 79 | }; 80 | 81 | function checkCondition() { 82 | if (wvReady) { 83 | while (cache.length) { 84 | var call = cache[0]; 85 | run(call.params, call.callback); 86 | cache.splice(0, 1); 87 | } 88 | } 89 | } 90 | 91 | function run(params, key) { 92 | var str = '();'; // default - if params is undefined 93 | 94 | if ( params ) { 95 | params.html && ( params.html = escape(params.html) ); 96 | str = '(' + JSON.stringify(params) + ');'; 97 | 98 | } else if ( params == '' ) { // params is '' 99 | str = '("");'; 100 | } 101 | 102 | $.container.evalJS( key + str ); 103 | } 104 | 105 | function wvLoaded(e) { 106 | wvReady = true; 107 | checkCondition(); 108 | } 109 | 110 | // 111 | 112 | var events = {}; 113 | 114 | exports.on = function(type, callback) { 115 | if (events[type]) { 116 | events[type].push(callback); 117 | } else { 118 | events[type] = [callback]; 119 | } 120 | return this; 121 | }; 122 | 123 | function fireEvent(e) { 124 | Ti.API.info('com.imobicloud.html:fireEvent ' + JSON.stringify( e )); 125 | 126 | var callbacks = events[e.etype]; 127 | if (callbacks) { 128 | for(var i=0,ii=callbacks.length; i 2 | 3 | -------------------------------------------------------------------------------- /com.imobicloud.html/widget.json: -------------------------------------------------------------------------------- 1 | { 2 | "id": "com.imobicloud.html", 3 | "name": "com.imobicloud.html", 4 | "description" : "", 5 | "author": "", 6 | "version": "1.0", 7 | "copyright":"Copyright (c) 2012", 8 | "license":"Public Domain", 9 | "min-alloy-version": "1.0", 10 | "min-titanium-version":"2.1", 11 | "tags":"", 12 | "platforms":"android,blackberry,ios,mobileweb" 13 | } -------------------------------------------------------------------------------- /com.imobicloud.keyboard_toolbar/controllers/widget.js: -------------------------------------------------------------------------------- 1 | var config, 2 | keyboardHeight, 3 | totalHeight, 4 | time; 5 | 6 | init(arguments[0] || {}); 7 | function init(args) { 8 | if (args.children) { 9 | _.each(args.children, function(child) { 10 | $.container.add(child); 11 | }); 12 | 13 | delete args.id; 14 | delete args.children; 15 | } 16 | } 17 | 18 | 19 | /* 20 | params = { 21 | height: 40, 22 | textfield: txt, 23 | persistent: false, 24 | window: win 25 | } 26 | * */ 27 | exports.init = function(params) { 28 | config = _.extend({ height: 40, persistent: false }, params); 29 | 30 | config.textfield.bottom = config.height; 31 | 32 | if (OS_IOS) { 33 | Ti.App.addEventListener('keyboardframechanged', updateUI); 34 | } else { 35 | config.textfield.addEventListener('click', toggle); 36 | config.textfield.addEventListener('focus', toggle); 37 | config.textfield.addEventListener('blur', toggle); 38 | } 39 | }; 40 | 41 | exports.unload = function() { 42 | if (OS_IOS) { 43 | Ti.App.removeEventListener('keyboardframechanged', updateUI); 44 | } else { 45 | config.textfield.removeEventListener('click', toggle); 46 | config.textfield.removeEventListener('focus', toggle); 47 | config.textfield.removeEventListener('blur', toggle); 48 | } 49 | 50 | config = null; 51 | }; 52 | 53 | function updateUI(e) { 54 | // IOS bug: after removeEventListener, this function is still run 55 | if (config == null) { return; } 56 | 57 | if (Ti.App.keyboardVisible) { 58 | keyboardHeight = e.keyboardFrame.height; 59 | totalHeight = keyboardHeight + config.height; 60 | 61 | config.textfield.bottom = totalHeight; 62 | $.container.bottom = keyboardHeight; 63 | 64 | fireEvent(true); 65 | } else { 66 | if (config.persistent !== true) { 67 | config.textfield.bottom = config.height; 68 | $.container.bottom = 0; 69 | } 70 | 71 | fireEvent(false); 72 | } 73 | } 74 | 75 | function toggle(e) { 76 | var now = new Date().getTime(); 77 | if (e.type != 'blur') { 78 | // TODO: Android: blur also fire focus event 79 | if (now - time < 500) { return; } 80 | 81 | if (keyboardHeight == null) { 82 | keyboardHeight = 300; //TODO: get Keyboard size 83 | totalHeight = keyboardHeight + config.height; 84 | } 85 | 86 | config.textfield.bottom = config.height; 87 | $.container.bottom = 0; 88 | 89 | fireEvent(true); 90 | } else { 91 | time = now; 92 | 93 | config.textfield.bottom = totalHeight; 94 | $.container.bottom = keyboardHeight; 95 | 96 | fireEvent(false); 97 | } 98 | } 99 | 100 | function fireEvent(visible) { 101 | config.textfield.fireEvent('keyboard:toggle', { visible: visible, height: keyboardHeight }); 102 | } -------------------------------------------------------------------------------- /com.imobicloud.keyboard_toolbar/styles/widget.tss: -------------------------------------------------------------------------------- 1 | "#container": { height: Ti.UI.SIZE, bottom: 0 } 2 | -------------------------------------------------------------------------------- /com.imobicloud.keyboard_toolbar/views/widget.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /com.imobicloud.keyboard_toolbar/widget.json: -------------------------------------------------------------------------------- 1 | { 2 | "id": "com.imobicloud.keyboard_toolbar", 3 | "name": "com.imobicloud.keyboard_toolbar", 4 | "description" : "", 5 | "author": "", 6 | "version": "1.0", 7 | "copyright":"Copyright (c) 2012", 8 | "license":"Public Domain", 9 | "min-alloy-version": "1.0", 10 | "min-titanium-version":"2.1", 11 | "tags":"", 12 | "platforms":"android,blackberry,ios,mobileweb" 13 | } -------------------------------------------------------------------------------- /com.imobicloud.label/README.md: -------------------------------------------------------------------------------- 1 | # Label 2 | ==== 3 | 4 | Formatted Label 5 | 6 | NOTE: FOR NEW UPDATES, VISIT THIS REPOSITORY: https://github.com/imobicloud/com.imobicloud.label 7 | 8 | xml 9 | 10 | 17 | 18 | 19 | tss 20 | 21 | ".tip-label": { width: 184.5, left: 66.5, font: { fontSize: 18, fontFamily: 'HelveticaNeue-Light' } } 22 | ".tip-label-2": { font: { fontSize: 18, fontFamily: 'HelveticaNeue-Light' } } 23 | 24 | js 25 | 26 | /* same as xml Widget tag 27 | // create 28 | $.getView().add( Alloy.createWidget('com.imobicloud.label', function() { 29 | var o = $.createStyle({ classes: 'tip-label' }); 30 | _.extend(o, { 31 | text: 'Tip: Swipe left and right to see all menus.', 32 | textColor: '#ffffff', 33 | search: [ 34 | { 'text': 'left', 'color': 'red', 'font': { 'fontSize': 18, 'fontFamily': 'HelveticaNeue-Medium' } }, 35 | { 'text': 'right', 'font': { 'fontSize': 18, 'fontFamily': 'HelveticaNeue-Bold' } } 36 | ] 37 | }); 38 | return o; 39 | }()).getView() ); 40 | */ 41 | 42 | // update 43 | $.label.setText(function() { 44 | var o = $.createStyle({ classes: 'tip-label-2' }); 45 | _.extend(o, { 46 | text: 'Tip: Swipe top and bottom to see all items.', 47 | textColor="#000000", 48 | search: [ 49 | { text: 'top', color: 'red' }, 50 | { text: 'bottom', color: 'blue' } 51 | ] 52 | }); 53 | return o; 54 | }()); 55 | -------------------------------------------------------------------------------- /com.imobicloud.label/controllers/widget.js: -------------------------------------------------------------------------------- 1 | 2 | init(arguments[0]); 3 | function init(args) { 4 | if (args && args.text) { 5 | formatText(args); 6 | } 7 | }; 8 | exports.setText = init; 9 | 10 | /* 11 | args = { 12 | // ... tss styles 13 | text: '', 14 | textColor: '#ffffff', 15 | search: [{ 'text': '', 'color': '#ffffff', 'font': { 'fontSize': 18, 'fontFamily': 'HelveticaNeue-Medium' } }], 16 | duplicate: true | false, 17 | case_sensitive: true | false 18 | } 19 | * */ 20 | function formatText(args) { 21 | var exclude = ['id', 'text', 'textColor', 'search']; 22 | $.label.applyProperties( _.omit(args, exclude) ); 23 | 24 | var text = args.text, 25 | _text = args.case_sensitive ? text.toLowerCase() : text, 26 | search, s, sText; 27 | 28 | if (args.search) { 29 | if (typeof(args.search) != 'string') { 30 | search = args.search; 31 | } else { 32 | search = JSON.parse( args.search.replace(/\'/g, '"') ); 33 | } 34 | } else { 35 | search = []; 36 | } 37 | 38 | if (OS_IOS) { 39 | var attributedString = Ti.UI.iOS.createAttributedString({ text: text }), 40 | startAt = 0, 41 | sIndex, sLength; 42 | 43 | if (args.textColor) { 44 | attributedString.addAttribute({ 45 | type: Ti.UI.iOS.ATTRIBUTE_FOREGROUND_COLOR, 46 | value: args.textColor, 47 | range: [0, text.length] 48 | }); 49 | } 50 | 51 | for(var i=0,j=search.length; i -1) { 71 | startAt += sIndex + sLength; 72 | }; 73 | }; 74 | 75 | $.label.attributedString = attributedString; 76 | } else { 77 | var html = '', 78 | tempText = text, 79 | sIndex = -1, 80 | hasBold = false; 81 | 82 | for(var i = 0, j = search.length; i < j; i++) { 83 | s = search[i]; 84 | sText = s.text + ''; 85 | 86 | if (args.case_sensitive) { 87 | sText = sText.toLowerCase(); 88 | sIndex = _text.indexOf(sText); 89 | sText = text.substring(sIndex, sIndex + sText.length); 90 | } else { 91 | sIndex = tempText.indexOf(sText); 92 | } 93 | 94 | // Android - Html does not support custom font 95 | // Use default font instead 96 | var isBold = false; 97 | if (s.font && ( s.font.fontFamily.indexOf('-Bold') != -1 || s.font.fontFamily.indexOf('-Medium') != -1 )) { 98 | isBold = true; 99 | if (hasBold === false) { 100 | $.label.font.fontFamily = 'sans-serif'; 101 | hasBold = true; 102 | } 103 | } 104 | 105 | var _html = (s.color ? '' : '') + (isBold ? '' : '') + sText + (isBold ? '' : '') + (s.color ? '' : ''); 106 | 107 | if (args.duplicate == false) { 108 | html += tempText.substring(0, sIndex + sText.length).replace(sText, _html); 109 | tempText = tempText.substring(sIndex + sText.length, tempText.length); 110 | } else { 111 | html = tempText.replace(sText, _html); 112 | } 113 | } 114 | 115 | args.textColor && ($.label.color = args.textColor); 116 | $.label.html = html; 117 | $.label.value = text; 118 | } 119 | } -------------------------------------------------------------------------------- /com.imobicloud.label/styles/widget.tss: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/imobicloud/ui/c9c6e5d270d63101393a71099e2089d24f27bfc0/com.imobicloud.label/styles/widget.tss -------------------------------------------------------------------------------- /com.imobicloud.label/views/widget.xml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /com.imobicloud.label/widget.json: -------------------------------------------------------------------------------- 1 | { 2 | "id": "com.imobicloud.label", 3 | "name": "com.imobicloud.label", 4 | "description" : "", 5 | "author": "", 6 | "version": "1.0", 7 | "copyright":"Copyright (c) 2012", 8 | "license":"Public Domain", 9 | "min-alloy-version": "1.0", 10 | "min-titanium-version":"2.1", 11 | "tags":"", 12 | "platforms":"android,blackberry,ios,mobileweb" 13 | } -------------------------------------------------------------------------------- /com.imobicloud.linklabel/controllers/widget.js: -------------------------------------------------------------------------------- 1 | init(arguments[0] || {}); 2 | 3 | /* 4 | args = { 5 | classes: null, 6 | text: '' 7 | } 8 | * */ 9 | function init(args) { 10 | args.classes && $.label.applyProperties( $.createStyle({ classes: args.classes }) ); 11 | 12 | var text = args.text; 13 | if (text) { 14 | var links = getLinks(text); 15 | 16 | if (OS_IOS) { 17 | // var attributedString = Ti.UI.iOS.createAttributedString({ text: text }); 18 | // for(var i = 0, ii = links.length; i < ii; i++) { 19 | // var link = links[i]; 20 | // attributedString.addAttribute({ 21 | // type: Ti.UI.iOS.ATTRIBUTE_LINK, 22 | // value: link, 23 | // range: [text.indexOf(link), link.length] 24 | // }); 25 | // }; 26 | // $.label.attributedString = attributedString; 27 | 28 | $.label.value = text; 29 | } else { 30 | // update for Alloy.js + tiapp.xml as this: http://fokkezb.nl/2013/08/26/url-schemes-for-ios-and-android-1/ 31 | // TODO: wait for https://jira.appcelerator.org/browse/TIMOB-18048 32 | 33 | // for(var i = 0, ii = links.length; i < ii; i++) { 34 | // var link = links[i]; 35 | // text = text.replace(link, '' + link + ''); 36 | // }; 37 | // $.label.html = text; 38 | 39 | $.label.text = text; 40 | } 41 | } 42 | } 43 | 44 | function getLinks(text) { 45 | // /^(?:(?![^:@]+:[^:@\/]*@)([^:\/?#.]+):)?(?:\/\/)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/ 46 | var urlRegex = /((([A-Za-z]{3,9}:(?:\/\/)?)(?:[\-;:&=\+\$,\w]+@)?[A-Za-z0-9\.\-]+|(?:www\.|[\-;:&=\+\$,\w]+@)[A-Za-z0-9\.\-]+)((?:\/[\+~%\/\.\w\-_]*)?\??(?:[\-\+=&;%@\.\w_]*)#?(?:[\.\!\/\\\w]*))?)/gi, 47 | links = [], 48 | parts; 49 | 50 | while ((parts = urlRegex.exec(text)) != null) { 51 | if (parts.index === urlRegex.lastIndex) { 52 | urlRegex.lastIndex++; 53 | } 54 | links.push(parts[1]); 55 | } 56 | 57 | return links; 58 | } 59 | 60 | // IOS 61 | 62 | function labelLink(e) { 63 | // e.cancelBubble = true;//TODO: is this necessary? 64 | $.trigger('link', e); 65 | } 66 | 67 | // ANDROID 68 | 69 | function labelClick(e) { 70 | Ti.API.error('com.imobicloud.linklabel:labelClick ' + JSON.stringify( e )); 71 | } -------------------------------------------------------------------------------- /com.imobicloud.linklabel/styles/widget.tss: -------------------------------------------------------------------------------- 1 | "#label": { color: '#000', font: { fontSize: 18 }, autoLink: Ti.UI.AUTOLINK_URLS } 2 | "#label[platform=ios]": { handleLinks: false, backgroundColor: 'transparent', scrollable: false, editable: false } 3 | // "#label[platform=android]": { } -------------------------------------------------------------------------------- /com.imobicloud.linklabel/views/widget.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /com.imobicloud.linklabel/widget.json: -------------------------------------------------------------------------------- 1 | { 2 | "id": "com.imobicloud.linklabel", 3 | "name": "com.imobicloud.linklabel", 4 | "description" : "", 5 | "author": "", 6 | "version": "1.0", 7 | "copyright":"Copyright (c) 2012", 8 | "license":"Public Domain", 9 | "min-alloy-version": "1.0", 10 | "min-titanium-version":"2.1", 11 | "tags":"", 12 | "platforms":"android,blackberry,ios,mobileweb" 13 | } -------------------------------------------------------------------------------- /com.imobicloud.picker/controllers/column.js: -------------------------------------------------------------------------------- 1 | var args = arguments[0] || {}, 2 | events = {}, 3 | selectedIndex; 4 | 5 | init(); 6 | function init() { 7 | var items = [], 8 | template = args.template || 'title'; 9 | 10 | for(var i=0,ii=args.rows.length; i 2 | 3 | 4 | 5 | 7 | 8 | 9 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /com.imobicloud.picker/views/picker_android.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /com.imobicloud.picker/views/picker_ios.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /com.imobicloud.picker/views/widget.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /com.imobicloud.picker/widget.json: -------------------------------------------------------------------------------- 1 | { 2 | "id": "com.imobicloud.picker", 3 | "name": "com.imobicloud.picker", 4 | "description" : "", 5 | "author": "", 6 | "version": "1.0", 7 | "copyright":"Copyright (c) 2012", 8 | "license":"Public Domain", 9 | "min-alloy-version": "1.0", 10 | "min-titanium-version":"2.1", 11 | "tags":"", 12 | "platforms":"android,blackberry,ios,mobileweb" 13 | } -------------------------------------------------------------------------------- /com.imobicloud.pull_to_refresh/controllers/widget.js: -------------------------------------------------------------------------------- 1 | // https://github.com/raymondkam/Ti.SwipeRefreshLayout 2 | // https://github.com/iskugor/Ti.SwipeRefreshLayout 3 | 4 | var refreshControl; 5 | 6 | init(arguments[0] || {}); 7 | 8 | /* 9 | args = { 10 | onRefresh: function(e){ e.endRefreshing(); } 11 | } 12 | * */ 13 | function init(args) { 14 | if (!_.isArray(args.children) || !_.contains(['Ti.UI.ListView', 'Ti.UI.TableView'], args.children[0].apiName)) { 15 | console.error('[pullToRefresh] is missing required Ti.UI.ListView or Ti.UI.TableView as first child element.'); 16 | return; 17 | } 18 | 19 | var list = args.children[0]; 20 | delete args.children; 21 | 22 | if (OS_IOS) { 23 | refreshControl = Ti.UI.createRefreshControl(); 24 | refreshControl.addEventListener('refreshstart', onRefresh); 25 | list.refreshControl = refreshControl; 26 | $.addTopLevelView(list); 27 | } else { 28 | refreshControl = require('com.rkam.swiperefreshlayout').createSwipeRefresh({ view : list }); 29 | refreshControl.addEventListener('refreshing', onRefresh); 30 | $.addTopLevelView(refreshControl); 31 | } 32 | 33 | // exports.beginRefreshing = beginRefreshing; 34 | // exports.endRefreshing = endRefreshing; 35 | exports.refresh = refresh; 36 | } 37 | 38 | function refresh() { 39 | beginRefreshing(); 40 | onRefresh(); 41 | } 42 | 43 | function beginRefreshing() { 44 | if (OS_IOS) { 45 | refreshControl.beginRefreshing(); 46 | } else if (OS_ANDROID) { 47 | refreshControl.setRefreshing(true); 48 | } 49 | }; 50 | 51 | function endRefreshing() { 52 | if (OS_IOS) { 53 | refreshControl.endRefreshing(); 54 | } else if (OS_ANDROID) { 55 | refreshControl.setRefreshing(false); 56 | } 57 | }; 58 | 59 | function onRefresh() { 60 | $.trigger('refresh', { 61 | source: $, 62 | endRefreshing: endRefreshing 63 | }); 64 | } -------------------------------------------------------------------------------- /com.imobicloud.pull_to_refresh/styles/widget.tss: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/imobicloud/ui/c9c6e5d270d63101393a71099e2089d24f27bfc0/com.imobicloud.pull_to_refresh/styles/widget.tss -------------------------------------------------------------------------------- /com.imobicloud.pull_to_refresh/views/widget.xml: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /com.imobicloud.pull_to_refresh/widget.json: -------------------------------------------------------------------------------- 1 | { 2 | "id": "com.imobicloud.pull_to_refresh", 3 | "name": "com.imobicloud.pull_to_refresh", 4 | "description" : "", 5 | "author": "", 6 | "version": "1.0", 7 | "copyright":"Copyright (c) 2012", 8 | "license":"Public Domain", 9 | "min-alloy-version": "1.0", 10 | "min-titanium-version":"2.1", 11 | "tags":"", 12 | "platforms":"android,blackberry,ios,mobileweb" 13 | } -------------------------------------------------------------------------------- /com.imobicloud.radio/controllers/widget.js: -------------------------------------------------------------------------------- 1 | var args = arguments[0] || {}, 2 | activeView, 3 | activeId; 4 | 5 | init(); 6 | 7 | /* 8 | 9 | args = { 10 | deselectable: false, 11 | items: [{ id: 1, title: '', selected: false }] 12 | } 13 | * */ 14 | function init() { 15 | args.items && loadRadios(args.items); 16 | }; 17 | 18 | exports.load = function(params) { 19 | args = params; 20 | init(); 21 | }; 22 | 23 | function loadRadios() { 24 | var container = $.getView(), 25 | items = args.items, 26 | found = false; 27 | 28 | for(var i=0,ii=items.length; i 2 | 3 | -------------------------------------------------------------------------------- /com.imobicloud.radio/widget.json: -------------------------------------------------------------------------------- 1 | { 2 | "id": "com.imobicloud.radio", 3 | "name": "com.imobicloud.radio", 4 | "description" : "", 5 | "author": "", 6 | "version": "1.0", 7 | "copyright":"Copyright (c) 2012", 8 | "license":"Public Domain", 9 | "min-alloy-version": "1.0", 10 | "min-titanium-version":"2.1", 11 | "tags":"", 12 | "platforms":"android,blackberry,ios,mobileweb,tizen" 13 | } -------------------------------------------------------------------------------- /com.imobicloud.slide_menu/README.md: -------------------------------------------------------------------------------- 1 | # Slide Menu 2 | ==== 3 | 4 | +NOTE: FOR NEW UPDATES, VISIT THIS REPOSITORY: https://github.com/imobicloud/com.imobicloud.slide_menu 5 | 6 | Slide menu with 2 anchors 7 | 8 | xml 9 | 10 | 11 | 12 | 13 | 14 | 15 | tss 16 | 17 | ".menu": { width: 230, top: 40, bottom: 30, left: 0 } 18 | "#content": { width: '100%', left: 0, backgroundColor: '#fff' } 19 | 20 | js 21 | 22 | // toggle menu 23 | $.menu.toggle(); 24 | $.menu.toggle(1); -------------------------------------------------------------------------------- /com.imobicloud.slide_menu/controllers/widget.js: -------------------------------------------------------------------------------- 1 | /* 2 | args = { 3 | anchors: [ 40, 200 ], 4 | defaultAnchor: 0, 5 | swipeToToggle: true, 6 | swipeWidth: 30 7 | } 8 | * */ 9 | var args = arguments[0] || {}, 10 | vars = {}; 11 | 12 | init(); 13 | 14 | function init() { 15 | var slider; 16 | 17 | if (args.children) { 18 | _.each(args.children, function(child) { 19 | if (child.role == 'slider') { 20 | slider = child; 21 | } 22 | __parentSymbol.add(child); 23 | }); 24 | 25 | delete args.id; 26 | delete args.children; 27 | } 28 | 29 | if (!slider) { 30 | alert('A widget child with [role="slider"] is required'); 31 | return; 32 | } 33 | 34 | // prepare slider 35 | 36 | args.anchors = JSON.parse(args.anchors); 37 | 38 | var slideIndex = args.defaultAnchor || 0; 39 | vars.slideIndex = slideIndex; 40 | slider.left = args.anchors[slideIndex]; 41 | 42 | if (args.swipeToToggle + '' != 'false') { 43 | slider.addEventListener('swipe', sliderSwiped); 44 | } 45 | 46 | vars.slider = slider; 47 | }; 48 | 49 | function sliderSwiped(e) { 50 | if (e.direction == 'left') { 51 | if (vars.slideIndex > 0) { 52 | slide(vars.slideIndex - 1); 53 | } 54 | } else if (e.direction == 'right') { 55 | if (!args.swipeWidth || e.x <= args.swipeWidth) { 56 | if (vars.slideIndex + 1 < args.anchors.length) { 57 | slide(vars.slideIndex + 1); 58 | } 59 | } 60 | } 61 | } 62 | 63 | exports.toggle = function(index) { 64 | if (typeof index != 'number') { 65 | index = null; 66 | } 67 | 68 | if (index === vars.slideIndex) { 69 | return; 70 | } 71 | 72 | if (index == null) { 73 | index = vars.slideIndex + 1; 74 | } 75 | 76 | if (index < args.anchors.length) { 77 | slide(index); 78 | } else { 79 | slide(0); 80 | } 81 | }; 82 | 83 | function slide(index, animated) { 84 | vars.slideIndex = index; 85 | 86 | if (animated !== false) { 87 | vars.slider.animate({ 88 | left: args.anchors[index], 89 | duration: 200, 90 | curve: Ti.UI.ANIMATION_CURVE_EASE_OUT 91 | }); 92 | } else { 93 | vars.slider.left = args.anchors[index]; 94 | } 95 | 96 | $.trigger('toggle', { index: index }); 97 | } -------------------------------------------------------------------------------- /com.imobicloud.slide_menu/styles/widget.tss: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/imobicloud/ui/c9c6e5d270d63101393a71099e2089d24f27bfc0/com.imobicloud.slide_menu/styles/widget.tss -------------------------------------------------------------------------------- /com.imobicloud.slide_menu/views/widget.xml: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /com.imobicloud.slide_menu/widget.json: -------------------------------------------------------------------------------- 1 | { 2 | "id": "com.imobicloud.slide_menu", 3 | "name": "com.imobicloud.slide_menu", 4 | "description" : "", 5 | "author": "", 6 | "version": "1.0", 7 | "copyright":"Copyright (c) 2012", 8 | "license":"Public Domain", 9 | "min-alloy-version": "1.0", 10 | "min-titanium-version":"2.1", 11 | "tags":"", 12 | "platforms":"android,blackberry,ios,mobileweb,tizen" 13 | } -------------------------------------------------------------------------------- /com.imobicloud.slider/README.md: -------------------------------------------------------------------------------- 1 | # Titanium UI - Slider 2 | 3 | ![Imgur](http://i.imgur.com/mJ82noZ.png) 4 | 5 | NOTE: FOR NEW UPDATES, VISIT THIS REPOSITORY: https://github.com/imobicloud/com.imobicloud.slider 6 | 7 | ==== 8 | 9 | View 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | Styles 18 | 19 | ".slider-players": { width: 227, height: 20, top: 20 } 20 | ".slider-players-target": { visible: false, touchEnabled: false } 21 | ".slider-players-track": { width: 207.5, height: 2, backgroundColor: '#a8adb0', borderRadius: 2, touchEnabled: false } 22 | ".slider-players-track-0": { } 23 | ".slider-players-track-1": { backgroundColor: '#abdb92' } 24 | ".slider-players-track-2": { backgroundColor: 'red' } 25 | ".slider-players-thumb": { width: 19, height: 20, backgroundImage: '/images/event_create/slider-handle.png', zIndex: 1 } 26 | ".slider-players-thumb-0": { } 27 | ".slider-players-thumb-1": { } 28 | ".slider-players-thumb-2": { } 29 | 30 | Controller 31 | 32 | // get value 33 | $.slider1.getValue(); // => [20] 34 | $.slider2.setValue(); // => [10,20,25] 35 | 36 | // set value 37 | $.slider1.setValue([25]); 38 | $.slider2.setValue([15, 20, 30]); 39 | 40 | function sliderChange(e){ 41 | alert(e.index + ' ' + e.value); 42 | } 43 | 44 | Events 45 | 46 | - change 47 | + index: thumb index 48 | + value: thumb value 49 | + pos: position of thumb 50 | 51 | - ready: 52 | + pos: array position of thumbs -------------------------------------------------------------------------------- /com.imobicloud.slider/controllers/widget.js: -------------------------------------------------------------------------------- 1 | /* 2 | args = { 3 | min: 0, 4 | max: 100, 5 | sensitive: 1, 6 | tssclass: '', 7 | targets: [0, 20, 40, 60, 80, 100], // or null 8 | values: [20, 80] 9 | } 10 | * */ 11 | var args = arguments[0] || {}, 12 | vars = {}, 13 | prefix = 'slider-' + args.tssclass + '-'; 14 | 15 | var measurement; 16 | OS_ANDROID && (measurement = require('alloy/measurement')); 17 | 18 | init(); 19 | function init() { 20 | // normalize data 21 | args.max = parseInt(args.max, 10); 22 | args.min = parseInt(args.min, 10); 23 | args.values = JSON.parse(args.values); 24 | // args.targets && (args.targets = JSON.parse(args.targets)); 25 | args.sensitive = args.sensitive ? parseInt(args.sensitive, 10) : 1; 26 | 27 | vars.range = args.max - args.min; 28 | 29 | var thumbWidth = $.createStyle({ classes: prefix + 'thumb' }).width; 30 | if (thumbWidth == null) { alert( 'tss class [' + prefix + 'thumb] required [width] value!' ); } 31 | vars.thumbWidth = thumbWidth; 32 | 33 | // 34 | 35 | $.addClass($.slider, prefix.substr(0, prefix.length - 1)); 36 | 37 | var track = $.UI.create('View', { classes: prefix + 'track' }); 38 | track.addEventListener('postlayout', postlayout); 39 | $.slider.add(track); 40 | 41 | for(var i=args.values.length - 1; i >= 0; i--){ 42 | var view = $.UI.create('View', { left: 0, width: 0 }); 43 | vars['view_' + i] = view; 44 | 45 | view.add( $.UI.create('View', { classes: prefix + 'track' + ' ' + prefix + 'track-' + i }) ); 46 | view.add( $.UI.create('View', { thumbIndex: i, classes: prefix + 'thumb' + ' ' + prefix + 'thumb-' + i, right: 0 }) ); 47 | 48 | $.slider.add(view); 49 | }; 50 | } 51 | 52 | function postlayout(e) { 53 | this.removeEventListener('postlayout', postlayout); 54 | 55 | var trackWidth = this.rect.width; 56 | vars.trackWidth = trackWidth; 57 | 58 | var partWidth = trackWidth / vars.range; 59 | vars.partWidth = partWidth; 60 | 61 | // if (args.targets) { 62 | // var targets = args.targets; 63 | // for(var i=targets.length - 1; i >= 0; i--){ 64 | // $.slider.add( $.UI.create('View', { classes: prefix + 'target' + ' ' + prefix + 'target-' + i, left: targets[i] * partWidth }) ); 65 | // }; 66 | // } 67 | 68 | var pos = [], 69 | min = args.min, 70 | values = args.values, 71 | thumbWidth = vars.thumbWidth, 72 | halfWidth = thumbWidth / 2; 73 | 74 | for(var i=values.length - 1; i >= 0; i--){ 75 | var width = (values[i] - min) * partWidth; 76 | width += thumbWidth; 77 | 78 | var view = vars['view_' + i]; 79 | view.width = width; 80 | view.children[0].applyProperties({ left: halfWidth, right: halfWidth }); 81 | 82 | pos.unshift(width); 83 | }; 84 | 85 | // 86 | 87 | $.trigger('ready', { pos: pos }); 88 | } 89 | 90 | function touchstart(e) { 91 | e.cancelBubble = true; 92 | vars.thumbIndex = e.source.thumbIndex; 93 | } 94 | 95 | function touchend(e) { 96 | e.cancelBubble = true; 97 | vars.thumbIndex = null; 98 | } 99 | 100 | function touchcancel(e) { 101 | e.cancelBubble = true; 102 | vars.thumbIndex = null; 103 | } 104 | 105 | function touchmove(e) { 106 | e.cancelBubble = true; 107 | if (vars.thumbIndex == null) { return; } 108 | if (vars.x != null && Math.abs(vars.x - e.x) >= args.sensitive) { return; } 109 | vars.x = e.x; 110 | 111 | var pos = e.source.convertPointToView({ x: e.x, y: e.y }, $.slider.children[0]); 112 | if (OS_ANDROID) { pos.x = measurement.pxToDP(pos.x); } 113 | if (pos.x < 0 || pos.x > vars.trackWidth) { return; } 114 | 115 | var index = vars.thumbIndex, 116 | width = pos.x, 117 | value = (width / vars.partWidth) + args.min; 118 | 119 | if (value - parseInt(value) >= 0.5) { 120 | value = Math.ceil(value); 121 | } else { 122 | value = Math.floor(value); 123 | } 124 | 125 | var prev = args.values[index - 1]; 126 | if (prev && value <= prev) { return; } 127 | var next = args.values[index + 1]; 128 | if (next && value >= next) { return; } 129 | 130 | args.values[index] = value; 131 | 132 | width += vars.thumbWidth; 133 | vars['view_' + index].width = width; 134 | $.trigger('change', { index: index, value: value, pos: width }); 135 | } 136 | 137 | exports.getValue = function(roundUp) { 138 | return args.values; 139 | }; 140 | 141 | function setValue(values) { 142 | args.values = values; 143 | 144 | var max = args.max, 145 | min = args.min, 146 | partWidth = vars.partWidth; 147 | 148 | for(var i=0,j=values.length; i max) { value = max; } 152 | 153 | var width = (value - min) * partWidth; 154 | width += vars.thumbWidth; 155 | vars['view_' + i].width = width; 156 | $.trigger('change', { index: i, value: value, pos: width }); 157 | }; 158 | }; 159 | exports.setValue = setValue; 160 | 161 | exports.update = function(params) { 162 | if (!params) { 163 | return; 164 | } 165 | 166 | args = params; 167 | 168 | if (args.min && args.max) { 169 | vars.range = args.max - args.min; 170 | vars.partWidth = vars.trackWidth / vars.range; 171 | } 172 | 173 | setValue(args.values); 174 | }; -------------------------------------------------------------------------------- /com.imobicloud.slider/styles/widget.tss: -------------------------------------------------------------------------------- 1 | /* 2 | // xxx is tssclass 3 | ".slider-xxx": { width: 227, height: 20, top: 20 } 4 | ".slider-xxx-target": { visible: false, touchEnabled: false } 5 | ".slider-xxx-track": { width: 207.5, height: 2, backgroundColor: '#a8adb0', borderRadius: 2, touchEnabled: false } 6 | ".slider-xxx-track-0": { } 7 | ".slider-xxx-track-1": { backgroundColor: '#abdb92' } 8 | ".slider-xxx-thumb": { width: 19, height: 20, backgroundImage: '/images/event_create/slider-handle.png', zIndex: 1 } 9 | ".slider-xxx-thumb-0": { } 10 | ".slider-xxx-thumb-1": { } 11 | */ -------------------------------------------------------------------------------- /com.imobicloud.slider/views/widget.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /com.imobicloud.slider/widget.json: -------------------------------------------------------------------------------- 1 | { 2 | "id": "com.imobicloud.slider", 3 | "name": "com.imobicloud.slider", 4 | "description" : "", 5 | "author": "", 6 | "version": "1.0", 7 | "copyright":"Copyright (c) 2012", 8 | "license":"Public Domain", 9 | "min-alloy-version": "1.0", 10 | "min-titanium-version":"2.1", 11 | "tags":"", 12 | "platforms":"android,blackberry,ios,mobileweb,tizen" 13 | } -------------------------------------------------------------------------------- /com.imobicloud.tabbed_bar/README.md: -------------------------------------------------------------------------------- 1 | # Tabbed Bar 2 | ==== 3 | 4 | NOTE: FOR NEW UPDATES, VISIT THIS REPOSITORY: https://github.com/imobicloud/com.imobicloud.tabbedbar 5 | 6 | Tabbed bar for iOS and Android 7 | 8 | xml 9 | 10 | 11 | 12 | tss 13 | 14 | ".tabbed-bar": { right: 15 } 15 | ".tabbed-bar[platform=android]": { width: Ti.UI.SIZE, height: 30, borderWidth: 1, borderColor: '#007aff', borderRadius: 3, layout: 'horizontal' } 16 | ".tabbed-bar-button": { color: '#007aff', font: { fontSize: 14 }, backgroundColor: 'transparent' } 17 | ".tabbed-bar-button-active": { backgroundColor: '#007aff', color: '#fff' } 18 | 19 | js 20 | 21 | $.tabbedBar.init({ 22 | index: 1, 23 | labels: [ 'Deep', 'Normal', 'High' ], 24 | styles: { right: 15 } 25 | }); 26 | 27 | $.tabbedBar.getIndex(); -------------------------------------------------------------------------------- /com.imobicloud.tabbed_bar/controllers/widget.js: -------------------------------------------------------------------------------- 1 | var onClick; 2 | 3 | /* 4 | params = { 5 | index: 0, 6 | labels: [ 'one', 'two', 'three' ], 7 | styles: {}, 8 | tssClass: null, 9 | onClick: function(index, label){} 10 | } 11 | * */ 12 | exports.init = function(params) { 13 | if (params.styles) { 14 | $.tabbedBar.applyProperties(params.styles); 15 | } 16 | 17 | var labels = params.labels, 18 | index = params.index, 19 | tssClass = params.tssClass; 20 | 21 | for(var i=0,ii=labels.length; i 2 | 3 | -------------------------------------------------------------------------------- /com.imobicloud.tabbed_bar/widget.json: -------------------------------------------------------------------------------- 1 | { 2 | "id": "com.imobicloud.tabbed_bar", 3 | "name": "com.imobicloud.tabbed_bar", 4 | "description" : "", 5 | "author": "", 6 | "version": "1.0", 7 | "copyright":"Copyright (c) 2012", 8 | "license":"Public Domain", 9 | "min-alloy-version": "1.0", 10 | "min-titanium-version":"2.1", 11 | "tags":"", 12 | "platforms":"android,blackberry,ios,mobileweb,tizen" 13 | } -------------------------------------------------------------------------------- /com.imobicloud.textarea/README.md: -------------------------------------------------------------------------------- 1 | # Titanium UI - Resizable Textarea 2 | 3 | Resizable Textarea can be used for message box in chat apps 4 | 5 | NOTE: FOR NEW UPDATES, VISIT THIS REPOSITORY: https://github.com/imobicloud/com.imobicloud.textarea 6 | 7 | ==== 8 | 9 | View 10 | 11 | 17 | 18 | Styles 19 | 20 | // app.tss 21 | ".ET-container": { height: Ti.UI.SIZE, bottom: 5, left: 5, right: 5 } 22 | ".ET-hint": { top: 7, left: 5, font: { fontSize: 12.5, fontFamily: 'HelveticaNeue-Medium' }, color: '#b7b7b7', touchEnabled: false, visible: true } 23 | ".ET-textarea": { width: '100%', height: Ti.UI.SIZE, font: { fontSize: 12.5, fontFamily: 'HelveticaNeue-Medium' }, color: '#b7b7b7', backgroundColor: 'transparent', suppressReturn: false } 24 | 25 | ".txt-message": { backgroundColor: 'red' } 26 | 27 | Controller 28 | 29 | // get value 30 | $.txtMessage.getValue() 31 | 32 | // set value 33 | $.txtMessage.setValue('Test message'); 34 | 35 | function txtMessageChange(e){ 36 | alert(e.value); 37 | } 38 | 39 | function txtMessageResize(e){ 40 | alert(e.height); 41 | } 42 | 43 | -------------------------------------------------------------------------------- /com.imobicloud.textarea/controllers/widget.js: -------------------------------------------------------------------------------- 1 | /* 2 | args = { 3 | class: null, // or tss classname 4 | maxHeight: 80, 5 | hintText: 'Enter message...' 6 | } 7 | * */ 8 | var args = arguments[0] || {}; 9 | args.maxHeight = args.maxHeight || 80; 10 | 11 | init(); 12 | function init() { 13 | var exclude = ['id', 'maxHeight', 'hintText'], 14 | style = _.omit(args, exclude); 15 | 16 | $.getView().applyProperties(style); 17 | 18 | if (style.height) { 19 | $.textarea.height = parseInt(style.height, 10); 20 | } else { 21 | $.textarea.addEventListener('postlayout', textareaPostlayout); 22 | } 23 | 24 | if (args.hintText) { 25 | if (OS_IOS) { 26 | $.hint.text = args.hintText; 27 | } else { 28 | $.textarea.hintText = args.hintText; 29 | } 30 | } 31 | }; 32 | 33 | function textareaChange(e) { 34 | var value = this.value; 35 | 36 | // toggle hint text 37 | if (OS_IOS) { 38 | if (value.length > 0) { 39 | $.hint.hide(); 40 | } else { 41 | $.hint.show(); 42 | } 43 | } 44 | 45 | // reset textarea height 46 | if (this._len && value.length < this._len) { 47 | this.height = Ti.UI.SIZE; 48 | } 49 | 50 | $.trigger('change', { value: value }); 51 | } 52 | 53 | // limit textarea height, less than args.maxHeight 54 | function textareaPostlayout(e) { 55 | if (this.rect.height > args.maxHeight) { 56 | this._len = this.value.length; 57 | this.height = args.maxHeight; 58 | } 59 | 60 | $.trigger('resize', { height: this.rect.height }); 61 | } 62 | 63 | exports.getHeight = function() { 64 | return $.textarea.rect.height; 65 | }; 66 | 67 | exports.getValue = function() { 68 | return $.textarea.value.trim(); 69 | }; 70 | 71 | exports.setValue = function(value) { 72 | $.textarea.value = value; 73 | return textareaChange.call( $.textarea ); 74 | }; 75 | 76 | exports.updateUI = function(style) { 77 | $.getView().applyProperties(style); 78 | }; -------------------------------------------------------------------------------- /com.imobicloud.textarea/styles/widget.tss: -------------------------------------------------------------------------------- 1 | /* 2 | ".ET-container": { height: Ti.UI.SIZE, left: 10, right: 10 } 3 | ".ET-hint": { top: 7, left: 5, font: { fontSize: 12 }, color: '#999', touchEnabled: false, visible: true } 4 | ".ET-textarea": { width: '100%', height: Ti.UI.SIZE, font: { fontSize: 12 }, color: '#000', backgroundColor: 'transparent', suppressReturn: false } 5 | */ 6 | -------------------------------------------------------------------------------- /com.imobicloud.textarea/views/widget.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /com.imobicloud.textarea/widget.json: -------------------------------------------------------------------------------- 1 | { 2 | "id": "com.imobicloud.textarea", 3 | "name": "com.imobicloud.textarea", 4 | "description" : "", 5 | "author": "", 6 | "version": "1.0", 7 | "copyright":"Copyright (c) 2012", 8 | "license":"Public Domain", 9 | "min-alloy-version": "1.0", 10 | "min-titanium-version":"2.1", 11 | "tags":"", 12 | "platforms":"android,blackberry,ios,mobileweb" 13 | } -------------------------------------------------------------------------------- /com.imobicloud.toast/controllers/message.js: -------------------------------------------------------------------------------- 1 | var args = arguments[0], 2 | timeout = args.timeout, 3 | callback = args.callback, 4 | timer; 5 | 6 | init(); 7 | function init() { 8 | var classes = args.type || 'error'; 9 | 10 | $.addClass($.getView(), 'toast-' + classes); 11 | $.addClass($.icon.parent, 'toast-wrapper-' + classes); 12 | args.icon && $.addClass($.icon, 'toast-icon-' + classes); 13 | $.addClass($.title.parent, 'toast-inner-' + classes); 14 | args.title && $.addClass($.title, 'toast-title-' + classes); 15 | $.addClass($.message, 'toast-message-' + classes); 16 | 17 | if (args.icon) { 18 | $.icon.image = args.icon; 19 | } else { 20 | $.icon.parent.remove($.icon); 21 | $.icon = null; 22 | } 23 | 24 | if (args.title) { 25 | $.title.text = args.title; 26 | } else { 27 | $.title.parent.remove($.title); 28 | $.title = null; 29 | } 30 | 31 | $.message.text = args.message; 32 | 33 | timer = setTimeout(messageTimeout, args.duration || 3000); 34 | } 35 | 36 | function messageTimeout() { 37 | timeout && timeout(); 38 | hideMe(); 39 | } 40 | 41 | function messageClick(e) { 42 | clearTimeout(timer); 43 | callback && callback(e); 44 | hideMe(); 45 | } 46 | 47 | function hideMe(e) { 48 | var container = $.getView(); 49 | container.parent.remove(container); 50 | container.fireEvent('toast:hide'); 51 | } -------------------------------------------------------------------------------- /com.imobicloud.toast/controllers/widget.js: -------------------------------------------------------------------------------- 1 | var args = arguments[0] || {}, 2 | cancelHide = false, 3 | hasGap = OS_IOS && parseInt(Ti.Platform.version, 10) >= 7 && args.hasNavBar == 'false'; 4 | 5 | init(); 6 | function init() { 7 | if (hasGap) { 8 | $.toast.add( $.UI.create('View', { height: 20 }) ); 9 | } 10 | } 11 | 12 | /* 13 | e= { 14 | message: '', // required 15 | 16 | type: 'error', // success, error, info 17 | duration: 3000, 18 | title: '', 19 | callback: function(e){}, 20 | timeout: function(e){} 21 | } 22 | * */ 23 | exports.show = function(e) { 24 | var container = $.toast; 25 | 26 | var message = Widget.createController('message', e).getView(); 27 | message.addEventListener('toast:hide', hideToast); 28 | container.add(message); 29 | 30 | var children = container.children, 31 | count = children.length; 32 | 33 | if (hasGap) { 34 | children[0].backgroundColor = children[1].backgroundColor; 35 | count--; 36 | } 37 | 38 | if (count > 1) { 39 | cancelHide = true; 40 | } else { 41 | container.animate({ opacity: 1, duration: 300 }); 42 | } 43 | }; 44 | 45 | function hideToast() { 46 | var children = $.toast.children, 47 | count = children.length; 48 | 49 | if (hasGap) { 50 | if (count > 1) { 51 | children[0].backgroundColor = children[1].backgroundColor; 52 | } 53 | count--; 54 | } 55 | 56 | if (count == 0 && cancelHide == false) { 57 | $.toast.animate({ opacity: 0, duration: 300 }); 58 | } 59 | 60 | cancelHide = false; 61 | } -------------------------------------------------------------------------------- /com.imobicloud.toast/styles/message.tss: -------------------------------------------------------------------------------- 1 | /* 2 | ".toast-container": { height: Ti.UI.SIZE } 3 | ".toast-error": { backgroundColor: '#dd4b39' } 4 | ".toast-info": { backgroundColor: '#3B5998' } 5 | ".toast-success": { backgroundColor: '#0eac4b' } 6 | ".toast-wrapper": { height: Ti.UI.SIZE, top: 10, right: 10, bottom: 10, layout: 'horizontal' } 7 | ".toast-icon": { width: 50, height: 50, top: 0, left: 10, touchEnabled: false } 8 | ".toast-inner": { height: Ti.UI.SIZE, top: 0, left: 10, layout: 'vertical', touchEnabled: false } 9 | ".toast-title": { left: 0, color: '#fff', font: { fontSize: 15, fontWeight: 'bold' }, touchEnabled: false } 10 | ".toast-message": { left: 0, color: '#fff', font: { fontSize: 14 }, touchEnabled: false } 11 | */ -------------------------------------------------------------------------------- /com.imobicloud.toast/styles/widget.tss: -------------------------------------------------------------------------------- 1 | // ".toast-list": { height: Ti.UI.SIZE, top: 0, opacity: 0, layout: 'vertical', zIndex: 4 } -------------------------------------------------------------------------------- /com.imobicloud.toast/views/message.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /com.imobicloud.toast/views/widget.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /com.imobicloud.toast/widget.json: -------------------------------------------------------------------------------- 1 | { 2 | "id": "com.imobicloud.toast", 3 | "name": "com.imobicloud.toast", 4 | "description" : "", 5 | "author": "", 6 | "version": "1.0", 7 | "copyright":"Copyright (c) 2012", 8 | "license":"Public Domain", 9 | "min-alloy-version": "1.0", 10 | "min-titanium-version":"2.1", 11 | "tags":"", 12 | "platforms":"android,blackberry,ios,mobileweb,tizen" 13 | } -------------------------------------------------------------------------------- /com.imobicloud.uploader/README.md: -------------------------------------------------------------------------------- 1 | # Titanium UI - Uploader 2 | 3 | ==== 4 | 5 | Show a dialog with 2 options: Take a photo or Load phote from gallery. 6 | After user select photo, return it via callback 7 | 8 | xml 9 | 10 | 11 | 12 | js 13 | 14 | function showCamera(e) { 15 | $.uploader.show(showCameraCallback); 16 | } 17 | 18 | function showCameraCallback(e) { 19 | // TODO: do something with e.media 20 | } -------------------------------------------------------------------------------- /com.imobicloud.uploader/controllers/widget.js: -------------------------------------------------------------------------------- 1 | var callback; 2 | 3 | exports.show = function(fnc) { 4 | callback = fnc; 5 | $.dialog.show(); 6 | }; 7 | 8 | function dialogClicked(e) { 9 | var opts = { 10 | title: 'Upload From?', 11 | mediaTypes: [ Ti.Media.MEDIA_TYPE_PHOTO ], 12 | success: callback, 13 | error: function() { 14 | Ti.UI.createAlertDialog({ message: 'Sorry, can not take a Photo now.', title: 'Upload Media' }).show(); 15 | } 16 | }; 17 | 18 | if ( e.index == 0 ) { 19 | opts.saveToPhotoGallery = true; 20 | Ti.Media.showCamera( opts ); 21 | } else if ( e.index == 1 ) { 22 | Ti.Media.openPhotoGallery( opts ); 23 | } 24 | } -------------------------------------------------------------------------------- /com.imobicloud.uploader/styles/widget.tss: -------------------------------------------------------------------------------- 1 | ".container": { visible: false } -------------------------------------------------------------------------------- /com.imobicloud.uploader/views/widget.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /com.imobicloud.uploader/widget.json: -------------------------------------------------------------------------------- 1 | { 2 | "id": "com.imobicloud.uploader", 3 | "name": "com.imobicloud.uploader", 4 | "description" : "", 5 | "author": "", 6 | "version": "1.0", 7 | "copyright":"Copyright (c) 2012", 8 | "license":"Public Domain", 9 | "min-alloy-version": "1.0", 10 | "min-titanium-version":"2.1", 11 | "tags":"", 12 | "platforms":"android,blackberry,ios,mobileweb,tizen" 13 | } -------------------------------------------------------------------------------- /pickers/README.md: -------------------------------------------------------------------------------- 1 | # Titanium UI - Pickers 2 | 3 | ==== 4 | 5 | ## Date picker 6 | 7 | xml 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | js 17 | 18 | var target; 19 | function showDatePicker(e) { 20 | var txt = e.source.children[0]; 21 | target = txt; 22 | $.datePicker.show(setDate, txt.dateValue); 23 | } 24 | 25 | function setDate(time) { 26 | target.dateValue = time; 27 | target.value = moment(time).format('M/D/YYYY'); 28 | $.datePicker.hide(); 29 | } 30 | 31 | ## Time Picker 32 | 33 | xml 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | js 43 | 44 | var target; 45 | function showTimePicker(e) { 46 | var txt = e.source.children[0]; 47 | target = txt; 48 | $.timePicker.show(setTime, txt.timeValue); 49 | } 50 | 51 | function setTime(time) { 52 | target.timeValue = time; 53 | target.value = moment(time).format('h:m A'); 54 | $.timePicker.hide(); 55 | } 56 | 57 | ## Value picker 58 | 59 | xml 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | ### One Column Picker 69 | 70 | js 71 | 72 | var target; 73 | 74 | function showTypePicker(e) { 75 | var data = [ 76 | { title: '1', value: 1 }, 77 | { title: '2', value: 2 }, 78 | { title: '3', value: 3 } 79 | ]; 80 | 81 | var txt = e.source.children[0]; 82 | target = txt; 83 | 84 | $.valuePicker.show({ 85 | callback: updateType, 86 | data: [ data ], 87 | indexs: txt.typeIndexs 88 | }); 89 | } 90 | 91 | function updateType(values, indexs) { 92 | target.typeIndexs = indexs; 93 | target.value = values[0].title; 94 | 95 | $.valuePicker.hide(); 96 | } 97 | 98 | ### Multi Column Picker 99 | 100 | js 101 | 102 | var target; 103 | 104 | function showTypePicker(e) { 105 | var column_1 = [ 106 | { title: '1', value: 1 }, 107 | { title: '2', value: 2 }, 108 | { title: '3', value: 3 } 109 | ], 110 | column_2 = [ 111 | { title: '4', value: 4 }, 112 | { title: '5', value: 5 }, 113 | { title: '6', value: 6 } 114 | ]; 115 | 116 | var txt = e.source.children[0]; 117 | target = txt; 118 | 119 | $.valuePicker.show({ 120 | callback: updateType, 121 | data: [ column_1, column_2 ], 122 | indexs: txt.typeIndexs 123 | }); 124 | } 125 | 126 | function updateType(values, indexs) { 127 | target.typeIndexs = indexs; 128 | target.value = values[0].title + ' - ' + values[1].title; 129 | 130 | $.valuePicker.hide(); 131 | } -------------------------------------------------------------------------------- /pickers/date_picker.js: -------------------------------------------------------------------------------- 1 | var callback; 2 | 3 | exports.show = function(fnc, date) { 4 | callback = fnc; 5 | 6 | if (OS_IOS) { 7 | $.datePicker.value = date || null; 8 | $.container.show(); 9 | } else { 10 | var options = { callback: setTime, okButtonTitle: 'Set', title: 'Select Date' }; 11 | if (date) { 12 | options.value = date; 13 | } 14 | Ti.UI.createPicker().showDatePickerDialog(options); 15 | } 16 | }; 17 | 18 | function hidePicker(e) { 19 | if (OS_IOS) { 20 | $.container.hide(); 21 | } else { 22 | 23 | } 24 | } 25 | 26 | exports.hide = hidePicker; 27 | 28 | function setTime(e) { 29 | if (OS_IOS) { 30 | callback( $.datePicker.value ); 31 | } else { 32 | //TODO: callback is called double. 33 | if (e.cancel === false) { 34 | callback( e.value ); 35 | } 36 | } 37 | } -------------------------------------------------------------------------------- /pickers/date_picker.tss: -------------------------------------------------------------------------------- 1 | ".container": { height: Ti.UI.SIZE, bottom: 0, layout: 'vertical', visible: false } 2 | ".toolbar": { borderBottom: false, borderTop: false } 3 | ".date-picker": { selectionIndicator: true, type: Ti.UI.PICKER_TYPE_DATE } 4 | -------------------------------------------------------------------------------- /pickers/date_picker.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 |