rosa-build/app/assets/javascripts/new_application.js

87 lines
2.1 KiB
JavaScript
Raw Normal View History

2014-03-30 06:45:52 +01:00
//= require jquery
2014-04-11 09:57:00 +01:00
//= require jquery_ujs
2014-05-26 18:42:27 +01:00
//= require jquery-ui
2014-04-02 11:32:35 +01:00
//= require js-routes
//= require bootstrap-sprockets
//= require angular
//= require angular-sanitize
//= require angular-ui-bootstrap-tpls
2014-04-11 09:57:00 +01:00
//= require ui-codemirror
//= require angular-i18n
2014-05-26 18:42:27 +01:00
//= require angular-resource
//= require ng-rails-csrf
//= require angular-cookies
//= require soundmanager2-nodebug-jsmin
2014-10-16 11:43:52 +01:00
//= require angular-rails-templates
//= require moment
//= require_tree ./angularjs
//= require loading-bar
2014-05-26 18:42:27 +01:00
//= require underscore
//= require zeroclipboard
//= require lib/Chart
2014-11-10 22:21:48 +00:00
//= require lib/bootstrap-typeahead
//= require lib/custom-bootstrap-typeahead
2014-11-10 18:46:44 +00:00
//= require extra/highlight
//= require extra/pull
2014-12-25 13:29:43 +00:00
//= require extra/scroller
//= require extra/fork
2014-06-03 10:21:13 +01:00
//= require_self
function setCookie (name, value, expires, path, domain, secure) {
document.cookie = name + "=" + escape(value) +
((expires) ? "; expires=" + expires : "") +
((path) ? "; path=" + path : "") +
((domain) ? "; domain=" + domain : "") +
((secure) ? "; secure" : "");
}
$(document).ready(function() {
2014-07-09 12:56:21 +01:00
$('.notify.alert button.close').click(function () {
2014-06-03 10:21:13 +01:00
var exdate=new Date();
exdate.setDate(exdate.getDate() + 365);
var expires="expires="+exdate.toUTCString();
setCookie("flash_notify_hash", FLASH_HASH_ID, expires);
});
2015-01-14 12:07:32 +00:00
var clip = new ZeroClipboard($("#copy_to_clipboard"));
2014-07-08 15:52:10 +01:00
$('.datetime_moment').each(function() {
2015-02-04 12:44:59 +00:00
var mtime = moment($(this).attr('origin_datetime'), 'YYYY-MM-DD HH:mm Z');
$(this).attr('title', mtime.utc().format('YYYY-MM-DD HH:mm:ss UTC'));
2014-07-08 15:52:10 +01:00
});
window.updateTime = function () {
$('.datetime_moment').each(function() {
2015-02-04 12:44:59 +00:00
var time = moment($(this).attr('origin_datetime'), 'YYYY-MM-DD HH:mm Z');
$(this).html(time.format('D MMM YYYY, HH:mm') + ' (' + time.fromNow() + ')');
2014-07-08 15:52:10 +01:00
});
};
updateTime();
setInterval( updateTime, 15000 );
2014-07-09 12:55:40 +01:00
// TODO refactoring
$('#branch_selector').change(function() {
var form = $('form#branch_changer');
form.attr('action', $(this).val());
form.submit();
});
2014-07-09 12:56:21 +01:00
$('#create_fork').click(function () {
$(this).button('loading');
});
2015-01-13 23:17:23 +00:00
$('[data-toggle="tooltip"]').tooltip();
2014-06-03 10:21:13 +01:00
});