first commit

This commit is contained in:
Senad Uka
2018-05-07 16:07:00 +02:00
commit 8b4f09f9d5
3368 changed files with 852614 additions and 0 deletions

View File

@@ -0,0 +1,41 @@
$(function(){
Messenger().post("Thanks for checking out Messenger!");
var loc = ['bottom', 'right'];
var style = 'flat';
var $output = $('.controls output');
var $lsel = $('.location-selector');
var $tsel = $('.theme-selector');
var update = function(){
var classes = 'messenger-fixed';
for (var i=0; i < loc.length; i++)
classes += ' messenger-on-' + loc[i];
$.globalMessenger({ extraClasses: classes, theme: style });
Messenger.options = { extraClasses: classes, theme: style };
$output.text("Messenger.options = {\n extraClasses: '" + classes + "',\n theme: '" + style + "'\n}");
};
update();
$lsel.locationSelector()
.on('update', function(pos){
loc = pos;
update();
})
;
$tsel.themeSelector({
themes: ['flat', 'future', 'block', 'air', 'ice']
}).on('update', function(theme){
style = theme;
update();
});
});

View File

@@ -0,0 +1,19 @@
$.fn.executr = (opts) ->
defaults =
codeSelector: 'code[executable]'
opts = $.extend {}, defaults, opts
this.on 'click', opts.codeSelector, (e) ->
$target = $ e.target
$code = $target.parents(opts.codeSelector)
ctx = window
if opts.setUp?
CoffeeScript.run opts.setUp, ctx
CoffeeScript.run $code.text(), ctx
if opts.tearDown?
CoffeeScript.run opts.tearDown, ctx

View File

@@ -0,0 +1,41 @@
class LocationSelector extends Backbone.View
className: 'location-selector'
events:
'click .bit': 'handleClick'
render: ->
@$el.html ''
do @draw
draw: ->
@_addBit 'top left'
@_addBit 'top right'
@_addBit 'top'
@_addBit 'bottom left'
@_addBit 'bottom right'
@_addBit 'bottom'
_addBit: (classes) ->
bit = $ '<div>'
bit.addClass "bit #{ classes }"
bit.attr 'data-position', classes
@$el.append bit
bit
handleClick: (e) ->
$bit = $ e.target
@trigger 'update', $bit.attr('data-position').split(' ')
$.fn.locationSelector = (opts) ->
loc = new LocationSelector $.extend {}, opts,
el: this
$(this).addClass loc.className
loc.render()
loc

View File

@@ -0,0 +1,63 @@
(function() {
var LocationSelector,
__hasProp = {}.hasOwnProperty,
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
LocationSelector = (function(_super) {
__extends(LocationSelector, _super);
function LocationSelector() {
return LocationSelector.__super__.constructor.apply(this, arguments);
}
LocationSelector.prototype.className = 'location-selector';
LocationSelector.prototype.events = {
'click .bit': 'handleClick'
};
LocationSelector.prototype.render = function() {
this.$el.html('');
return this.draw();
};
LocationSelector.prototype.draw = function() {
this._addBit('top left');
this._addBit('top right');
this._addBit('top');
this._addBit('bottom left');
this._addBit('bottom right');
return this._addBit('bottom');
};
LocationSelector.prototype._addBit = function(classes) {
var bit;
bit = $('<div>');
bit.addClass("bit " + classes);
bit.attr('data-position', classes);
this.$el.append(bit);
return bit;
};
LocationSelector.prototype.handleClick = function(e) {
var $bit;
$bit = $(e.target);
return this.trigger('update', $bit.attr('data-position').split(' '));
};
return LocationSelector;
})(Backbone.View);
$.fn.locationSelector = function(opts) {
var loc;
loc = new LocationSelector($.extend({}, opts, {
el: this
}));
$(this).addClass(loc.className);
loc.render();
return loc;
};
}).call(this);

View File

@@ -0,0 +1 @@
console.log('This would be the main JS file.');

View File

@@ -0,0 +1,30 @@
class ThemeSelector extends Backbone.View
tagName: 'ul'
className: 'theme-selector'
events:
'click li': 'handleClick'
render: ->
@$el.html ''
for theme in @options.themes
$li = $ '<li>'
$li.attr 'data-id', theme
$li.text theme
@$el.append $li
handleClick: (e) ->
$li = $ e.target
@trigger 'update', $li.attr('data-id')
$.fn.themeSelector = (opts) ->
sel = new ThemeSelector $.extend {}, opts,
el: this
$(this).addClass sel.className
sel.render()
sel

View File

@@ -0,0 +1,57 @@
(function() {
var ThemeSelector,
__hasProp = {}.hasOwnProperty,
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
ThemeSelector = (function(_super) {
__extends(ThemeSelector, _super);
function ThemeSelector() {
return ThemeSelector.__super__.constructor.apply(this, arguments);
}
ThemeSelector.prototype.tagName = 'ul';
ThemeSelector.prototype.className = 'theme-selector';
ThemeSelector.prototype.events = {
'click li': 'handleClick'
};
ThemeSelector.prototype.render = function() {
var $li, theme, _i, _len, _ref, _results;
this.$el.html('');
_ref = this.options.themes;
_results = [];
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
theme = _ref[_i];
$li = $('<li>');
$li.attr('data-id', theme);
$li.text(theme);
_results.push(this.$el.append($li));
}
return _results;
};
ThemeSelector.prototype.handleClick = function(e) {
var $li;
$li = $(e.target);
return this.trigger('update', $li.attr('data-id'));
};
return ThemeSelector;
})(Backbone.View);
$.fn.themeSelector = function(opts) {
var sel;
sel = new ThemeSelector($.extend({}, opts, {
el: this
}));
$(this).addClass(sel.className);
sel.render();
return sel;
};
}).call(this);