View app.js
| /** | |
| * Triggers a bootstrap popover with signin/register view | |
| */ | |
| vent.on('app:signin:popover', function ($parentEl, msg, fn) { | |
| $parentEl.append('<div class="popover-region"></div>'); | |
| app.addRegions({ | |
| popover: { | |
| selector: '.popover-region', | |
| parentEl: $parentEl, | |
| regionType: Marionette.Region.Popover |
View SomeView.js
| vent.trigger('app:modal:show', new PaymentModalView()); |
View handler-selectize.js
| define([ | |
| 'jquery', | |
| 'backbone', | |
| 'underscore', | |
| 'backbone.stickit', | |
| 'selectize' | |
| ], | |
| function ($, Backbone, _) { |
View app.js
| define([ | |
| 'config', | |
| 'underscore', | |
| 'backbone', | |
| 'marionette', | |
| 'vent' | |
| ], | |
| function (config, _, Backbone, Marionette, vent) { |
View maybemonad.js
| // from http://osteele.com/posts/2007/12/monads-on-the-cheap-i-the-maybe-monad | |
| var locationCode = ((cartDelivery||{}).Location||{}).Code; | |
| if (locationCode) { | |
| var name = RF.Models.Cart.get('Delivery').Location.Name; | |
| return name; | |
| } |
View PHP User Agent Dectection
| preg_match('/alexa|bot|crawl(er|ing)|facebookexternalhit|feedburner|google web preview|nagios|postrank|pingdom|slurp|spider|yahoo!|yandex|^$/i', $_SERVER['HTTP_USER_AGENT'], $matches); | |
| if (!$matches) { | |
| $_SERVER['REQUEST_URI_PATH'] = parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH); | |
| $segments = explode('/', $_SERVER['REQUEST_URI_PATH']); | |
| } | |
| ?> |
View addthisBBInit
| initAddThis: function() { | |
| var addthis_config = | |
| { | |
| data_track_clickback: true, | |
| data_ga_property: 'UA-xxxxxxx-x', | |
| data_ga_social : true | |
| }; | |
View get_color
| function get_color(start = "000000",end = "ffffff",percent = 50) | |
| { | |
| // start should always be darker | |
| var sr = start.slice(0,2), sg = start.slice(2,2), sb = start.slice(4,2), er = end.slice(0,2), eg = end.slice(2,2), eb = end.slice(4,2); | |
| var r = Math.ceil(((parseInt(er,16) - parseInt(sr,16))*percent)+parseInt(sr,16)), g = Math.ceil(((parseInt(eg,16) - parseInt(sg,16))*percent)+parseInt(sg,16)), b = Math.ceil(((parseInt(eb,16) - parseInt(sb,16))*percent)+parseInt(sb,16)); | |
| var hex = (r << 16) | (g << 8) | b; | |
| return "#"+hex.toString(16); | |
| } |