Skip to content

Commit

Permalink
First commit of modular refactoring of emoncms, for history up and to…
Browse files Browse the repository at this point in the history
  • Loading branch information
Trystan committed Oct 15, 2012
0 parents commit a754567
Show file tree
Hide file tree
Showing 112 changed files with 24,636 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
settings.php
22 changes: 22 additions & 0 deletions .htaccess
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#
# Apache/PHP/Emoncms settings:
#

# Don't show directory listings for URLs which map to a directory.
Options -Indexes

# Make Drupal handle any 404 errors.
ErrorDocument 404 /index.php

# Set the default handler.
DirectoryIndex index.php

# Various rewrite rules.
<IfModule mod_rewrite.c>
RewriteEngine on
# Rewrite URLs of the form 'x' to the form 'index.php?q=x'.
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !=/favicon.ico
RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]
</IfModule>
24 changes: 24 additions & 0 deletions COPYRIGHT.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
Emoncms v3 - open source energy visualisation
Part of the openenergymonitor.org project

Copyright (C) 2011,2012 the OpenEnergyMonitor researchers (see individual contributions from github commits)

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 of the
License, or any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.

You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.

Contact:

Trystan Lea
[email protected]
http://openenergymonitor.org

619 changes: 619 additions & 0 deletions LICENSE.txt

Large diffs are not rendered by default.

9 changes: 9 additions & 0 deletions Lib/bootstrap/css/bootstrap-responsive.min.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions Lib/bootstrap/css/bootstrap.min.css

Large diffs are not rendered by default.

Binary file added Lib/bootstrap/img/glyphicons-halflings-white.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Lib/bootstrap/img/glyphicons-halflings.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
218 changes: 218 additions & 0 deletions Lib/bootstrap/js/bootstrap-modal.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,218 @@
/* =========================================================
* bootstrap-modal.js v2.0.4
* http://twitter.github.com/bootstrap/javascript.html#modals
* =========================================================
* Copyright 2012 Twitter, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* ========================================================= */


!function ($) {

"use strict"; // jshint ;_;


/* MODAL CLASS DEFINITION
* ====================== */

var Modal = function (content, options) {
this.options = options
this.$element = $(content)
.delegate('[data-dismiss="modal"]', 'click.dismiss.modal', $.proxy(this.hide, this))
}

Modal.prototype = {

constructor: Modal

, toggle: function () {
return this[!this.isShown ? 'show' : 'hide']()
}

, show: function () {
var that = this
, e = $.Event('show')

this.$element.trigger(e)

if (this.isShown || e.isDefaultPrevented()) return

$('body').addClass('modal-open')

this.isShown = true

escape.call(this)
backdrop.call(this, function () {
var transition = $.support.transition && that.$element.hasClass('fade')

if (!that.$element.parent().length) {
that.$element.appendTo(document.body) //don't move modals dom position
}

that.$element
.show()

if (transition) {
that.$element[0].offsetWidth // force reflow
}

that.$element.addClass('in')

transition ?
that.$element.one($.support.transition.end, function () { that.$element.trigger('shown') }) :
that.$element.trigger('shown')

})
}

, hide: function (e) {
e && e.preventDefault()

var that = this

e = $.Event('hide')

this.$element.trigger(e)

if (!this.isShown || e.isDefaultPrevented()) return

this.isShown = false

$('body').removeClass('modal-open')

escape.call(this)

this.$element.removeClass('in')

$.support.transition && this.$element.hasClass('fade') ?
hideWithTransition.call(this) :
hideModal.call(this)
}

}


/* MODAL PRIVATE METHODS
* ===================== */

function hideWithTransition() {
var that = this
, timeout = setTimeout(function () {
that.$element.off($.support.transition.end)
hideModal.call(that)
}, 500)

this.$element.one($.support.transition.end, function () {
clearTimeout(timeout)
hideModal.call(that)
})
}

function hideModal(that) {
this.$element
.hide()
.trigger('hidden')

backdrop.call(this)
}

function backdrop(callback) {
var that = this
, animate = this.$element.hasClass('fade') ? 'fade' : ''

if (this.isShown && this.options.backdrop) {
var doAnimate = $.support.transition && animate

this.$backdrop = $('<div class="modal-backdrop ' + animate + '" />')
.appendTo(document.body)

if (this.options.backdrop != 'static') {
this.$backdrop.click($.proxy(this.hide, this))
}

if (doAnimate) this.$backdrop[0].offsetWidth // force reflow

this.$backdrop.addClass('in')

doAnimate ?
this.$backdrop.one($.support.transition.end, callback) :
callback()

} else if (!this.isShown && this.$backdrop) {
this.$backdrop.removeClass('in')

$.support.transition && this.$element.hasClass('fade')?
this.$backdrop.one($.support.transition.end, $.proxy(removeBackdrop, this)) :
removeBackdrop.call(this)

} else if (callback) {
callback()
}
}

function removeBackdrop() {
this.$backdrop.remove()
this.$backdrop = null
}

function escape() {
var that = this
if (this.isShown && this.options.keyboard) {
$(document).on('keyup.dismiss.modal', function ( e ) {
e.which == 27 && that.hide()
})
} else if (!this.isShown) {
$(document).off('keyup.dismiss.modal')
}
}


/* MODAL PLUGIN DEFINITION
* ======================= */

$.fn.modal = function (option) {
return this.each(function () {
var $this = $(this)
, data = $this.data('modal')
, options = $.extend({}, $.fn.modal.defaults, $this.data(), typeof option == 'object' && option)
if (!data) $this.data('modal', (data = new Modal(this, options)))
if (typeof option == 'string') data[option]()
else if (options.show) data.show()
})
}

$.fn.modal.defaults = {
backdrop: true
, keyboard: true
, show: true
}

$.fn.modal.Constructor = Modal


/* MODAL DATA-API
* ============== */

$(function () {
$('body').on('click.modal.data-api', '[data-toggle="modal"]', function ( e ) {
var $this = $(this), href
, $target = $($this.attr('data-target') || (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '')) //strip for ie7
, option = $target.data('modal') ? 'toggle' : $.extend({}, $target.data(), $this.data())

e.preventDefault()
$target.modal(option)
})
})

}(window.jQuery);
61 changes: 61 additions & 0 deletions Lib/bootstrap/js/bootstrap-transition.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
/* ===================================================
* bootstrap-transition.js v2.0.4
* http://twitter.github.com/bootstrap/javascript.html#transitions
* ===================================================
* Copyright 2012 Twitter, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* ========================================================== */


!function ($) {

$(function () {

"use strict"; // jshint ;_;


/* CSS TRANSITION SUPPORT (http://www.modernizr.com/)
* ======================================================= */

$.support.transition = (function () {

var transitionEnd = (function () {

var el = document.createElement('bootstrap')
, transEndEventNames = {
'WebkitTransition' : 'webkitTransitionEnd'
, 'MozTransition' : 'transitionend'
, 'OTransition' : 'oTransitionEnd'
, 'msTransition' : 'MSTransitionEnd'
, 'transition' : 'transitionend'
}
, name

for (name in transEndEventNames){
if (el.style[name] !== undefined) {
return transEndEventNames[name]
}
}

}())

return transitionEnd && {
end: transitionEnd
}

})()

})

}(window.jQuery);
Loading

0 comments on commit a754567

Please sign in to comment.