Skip to content

Commit

Permalink
added files
Browse files Browse the repository at this point in the history
  • Loading branch information
Parziphal committed Oct 26, 2013
1 parent f4c03a4 commit 13227f0
Show file tree
Hide file tree
Showing 768 changed files with 72,005 additions and 18,894 deletions.
20 changes: 0 additions & 20 deletions LICENSE

This file was deleted.

4 changes: 0 additions & 4 deletions README.md

This file was deleted.

19 changes: 19 additions & 0 deletions app/assets/javascripts/application.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
// Place your application-specific JavaScript functions and classes here
// This file is automatically included by javascript_include_tag :defaults
//
//= require prefix
//= require jquery
//= require jquery_ujs
//= require jquery.cookie
//= require jquery.ui.autocomplete
//= require compat.jquery
//= require mousetrap
//= require i18n
//= require i18n/translations
//= require i18n_scopify
//= require cookie
//= require dmail
//= require favorite
//= require forum
//= require user_record
//= require_tree .
76 changes: 76 additions & 0 deletions app/assets/javascripts/comment.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
(function($, t) {
Comment = {
spoiler: function(obj) {
var text = $(obj).next('.spoilertext');
var warning = $(obj).children('.spoilerwarning');
obj.hide();
text.show();
},

flag: function(id) {
if(!confirm(t('.flag_ask')))
return;

notice(t('.flag_process'))

$.ajax({
url: Moebooru.path('/comment/mark_as_spam.json'),
type: 'post',
data: {
'id': id,
'comment[is_spam]': 1
}
}).done(function(resp) {
notice(t('.flag_notice'));
}).fail(function(resp) {
var resp = $.parseJSON(resp.responseText)
notice(t('js.error') + resp.reason);
})
},

quote: function(id) {
$.ajax({
url: Moebooru.path('/comment/show.json'),
type: 'get',
data: {
'id': id
}
}).done(function(resp) {
var stripped_body = resp.body.replace(/\[quote\](?:.|\n|\r)+?\[\/quote\](?:\r\n|\r|\n)*/gm, '')
var body = '[quote]' + resp.creator + ' said:\n' + stripped_body + '\n[/quote]\n\n'
$('#reply-' + resp.post_id).show()
if ($('#respond-link-' + resp.post_id)) {
$('#respond-link-' + resp.post_id).hide()
}
var reply_box = $('#reply-text-' + resp.post_id)
reply_box.val(reply_box.val() + body);
reply_box.focus();
}).fail(function() {
notice(t('.quote_error'))
});
},

destroy: function(id) {
if (!confirm(t('.delete_ask')) ) {
return;
}
$.ajax({
url: Moebooru.path('/comment/destroy.json'),
type: 'post',
data: { 'id': id }
}).done(function(resp) {
document.location.reload()
}).fail(function(resp) {
var resp = $.parseJSON(resp.responseText)
notice(t('.delete_error') + resp.reason)
});
},

show_reply_form: function(post_id)
{
$('#respond-link-' + post_id).hide();
$('#reply-' + post_id).show();
$('#reply-' + post_id).find('textarea').focus();
}
}
}) (jQuery, I18n.scopify('js.comment'));
1 change: 1 addition & 0 deletions app/assets/javascripts/compat.jquery.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
jQuery.noConflict();
3 changes: 3 additions & 0 deletions app/assets/javascripts/cookie-defaults.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
(function($) {
$.cookie.defaults['path'] = PREFIX;
}) (jQuery);
33 changes: 33 additions & 0 deletions app/assets/javascripts/cookie.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
// FIXME: I think the correct way would be replacing all calls to this
// with jQuery.cookie.
(function($) {
$.cookie.defaults['path'] = PREFIX;
$.cookie.defaults['expires'] = 365;
Cookie = {
put: function(name, value, days) {
var options = null;
if (days) {
options = { expires: days };
};
$.cookie(name, value, options);
},

get: function(name) {
// FIXME: compatibility reason. Should sweep this with !! check
// or something similar in relevant codes.
return $.cookie(name) || '';
},

get_int: function(name) {
parseInt($.cookie(name));
},

remove: function(name) {
$.removeCookie(name);
},

unescape: function(value) {
return window.decodeURIComponent(value.replace(/\+/g, " "))
}
};
}) (jQuery);
27 changes: 27 additions & 0 deletions app/assets/javascripts/dmail.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
(function($) {
Dmail = {
respond: function(to) {
$('#dmail_to_name').val(to);
var stripped_body = $('#dmail_body').val().replace(/\[quote\](?:.|\n)+?\[\/quote\]\n*/gm, "");
$('#dmail_body').val("[quote]You said:\n" + stripped_body + "\n[/quote]\n\n");
$('#response').show();
},

expand: function(parent_id, id) {
notice("Fetching previous messages...")

$.ajax({
url: Moebooru.path('/dmail/show_previous_messages'),
type: 'get',
data: {
"id": id,
"parent_id": parent_id
}
}).done(function(data) {
$('#previous-messages').html(data);
$('#previous-messages').show();
notice('Previous messages loaded');
})
}
}
}) (jQuery);
19 changes: 19 additions & 0 deletions app/assets/javascripts/favorite.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
(function($) {
Favorite = {
link_to_users: function(users) {
var html = ""

if (users.size() == 0) {
return "no one"
} else {
html = users.slice(0, 6).map(function(x) {return '<a href="/user/show/' + x.id + '">' + x.name + '</a>'}).join(", ")

if (users.size() > 6) {
html += '<span id="remaining-favs" style="display: none;">' + users.slice(6, -1).map(function(x) {return '<a href="/user/show/' + x.id + '">' + x.name + '</a>'}).join(", ") + '</span> <span id="remaining-favs-link">(<a href="#" onclick="$(\'remaining-favs\').show(); $(\'remaining-favs-link\').hide(); return false;">' + (users.size() - 6) + ' more</a>)</span>'
}

return html
}
}
}
}) (jQuery);
33 changes: 33 additions & 0 deletions app/assets/javascripts/forum.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
(function($) {
Forum = {
mark_all_read: function() {
$.ajax({
url: Moebooru.path('/forum/mark_all_read'),
}).done(function() {
$('span.forum-topic').removeClass('unread-topic');
$('div.forum-update').removeClass('forum-update');
Menu.sync_forum_menu();
notice("Marked all topics as read");
});
},
quote: function(id) {
$.ajax({
url: Moebooru.path('/forum/show.json'),
type: 'get',
data: {
'id': id
}
}).done(function(resp) {
var stripped_body = resp.body.replace(/\[quote\](?:.|\n|\r)+?\[\/quote\][\n\r]*/gm, '');
$('#reply').show();
$('#forum_post_body').val(function(i, val) { return val + '[quote]' + resp.creator + ' said:\n' + stripped_body + '\n[/quote]\n\n'; });
if($('#respond-link'))
$('#respond-link').hide();
if($('#forum_post_body'))
$('#forum_post_body').focus();
}).fail(function() {
notice("Error quoting forum post");
});
}
}
}) (jQuery);
2 changes: 2 additions & 0 deletions app/assets/javascripts/i18n/translations.js

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

9 changes: 9 additions & 0 deletions app/assets/javascripts/i18n_scopify.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
(function () {
I18n.scopify = function (scope) {
return function (label, options) {
if (label.charAt(0) == '.')
label = scope + label;
return I18n.t(label, options);
}
};
})();
17 changes: 17 additions & 0 deletions app/assets/javascripts/init.autocomplete.js.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?php $url = Rails::application()->router()->url_helpers() ?>
jQuery(document).ready(function($) {
$('input.ac-user-name').autocomplete({
source: '<?= $url->acUserNamePath() ?>',
minLength: 2
});
$('input.ac-tag-name').autocomplete({
source: '<?= $url->acTagNamePath() ?>',
minLength: 2
});
if ($('#edit-form').length && $('textarea.ac-tags').length) {
new TagCompletionBox($('textarea.ac-tags')[0]);
if (TagCompletion) {
TagCompletion.observe_tag_changes_on_submit($('#edit-form')[0], $('input.ac-tags')[0], null);
};
};
});
22 changes: 22 additions & 0 deletions app/assets/javascripts/init.cookie.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
jQuery(document).ready(function($) {
// Check if there's new dmail.
if ($.cookie('has_mail') == '1') {
$('#has-mail-notice').show();
};

// Check if there's new comment.
if ($.cookie('comments_updated') == '1') {
$('#comments-link').addClass('comments-update')
$('#comments-link').addClass('bolded');
};

// Show block/ban reason if the user is blocked/banned.
if ($.cookie('block_reason') && $.cookie('block_reason') != '') {
$('#block-reason').text($.cookie('block_reason')).show();
};

// Check if there's any pending post moderation queue.
if (parseInt($.cookie('mod_pending')) > 0) {
$('#moderate').addClass('mod-pending');
};
});
5 changes: 5 additions & 0 deletions app/assets/javascripts/init.menu.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
jQuery(document).ready(function($) {
Menu.init();
$(document).on('click', '#main-menu .search-link', function(e) { return Menu.show_search_box(e.currentTarget); });
$(document).on('click', Menu.toggle);
});
3 changes: 3 additions & 0 deletions app/assets/javascripts/init.menu_drag_drop.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
jQuery(document).ready(function($) {
MenuDragDrop.init();
});
12 changes: 12 additions & 0 deletions app/assets/javascripts/init.news.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
jQuery(document).ready(function($) {
if ($.cookie('hide-news-ticker') !== '1') {
$('#news-ticker').show();
$('#close-news-ticker-link').on('click', function() {
$('#news-ticker').hide();
$.cookie('hide-news-ticker', '1', {
expires: 7
});
return false;
});
};
});
7 changes: 7 additions & 0 deletions app/assets/javascripts/init.post_edit.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
jQuery(document).ready(function($) {
$('#post_tags').val(
$.map($('li.tag-link'),
function(t, _) { return $(t).data('name'); }
).join(' ')
);
});
5 changes: 5 additions & 0 deletions app/assets/javascripts/jquery.js

Large diffs are not rendered by default.

Loading

0 comments on commit 13227f0

Please sign in to comment.