Permalink
Browse files

Added scrolling after quoting, sub option in menu, modifications to CSS

  • Loading branch information...
1 parent 7322e07 commit c93f6c0ba6c8bb457456b9bfe031a6a6a6235d99 @pokonski pokonski committed Mar 31, 2012
Showing with 30 additions and 6 deletions.
  1. +5 −1 css/humpinator.css
  2. +5 −0 humpinator.js
  3. +6 −3 menu.js
  4. +14 −2 utils.js
View
@@ -11,12 +11,16 @@
top: -60px;
left: 0;
}
-.humpinator-options > li > a{
+.humpinator-options li a{
vertical-align: middle;
position: relative;
top: 1px
}
.humpinator-options input[type=checkbox] {
vertical-align: middle;
position: relative;
+}
+
+.humpinator-options > li > ul{
+ padding-left: 10px;
}
View
@@ -38,13 +38,18 @@ if (getValue("fullReplyForm") === "true"){
/* INSTANT QUOTING */
if (getValue("instantQuotes") === "true"){
$(document).on('click','div.forumbutton > ul#navlist > li > a[href^="posting.php?mode=quote"]',function(){
+ var button = $(this).hide();
$.ajax($(this).attr('href'), {
dataType: 'text',
success: function(data, textStatus, jqXHR){
var textarea = $(document).find('textarea[name="message"]');
var current_value = textarea.val();
var content = $('<div/>').append(data.replace("urchinTracker();","")).find('textarea[name="message"]');
textarea.val(current_value + (current_value.length == 0 ? "" : "\n") + content.val());
+ if (getValue("scrollAfterQuote") === "true"){
+ scrollViewportTo(textarea,100);
+ }
+ button.show();
}
});
return false;
View
@@ -2,7 +2,10 @@
var leftcolumn = $('#leftdiv');
var menu = $('<div class="menuLeftContainer"><ul class="menuLeftList humpinator-options"/></div>').find(".menuLeftList");
for(var key in options) {
- var checkbox = $('<li><input type="checkbox" name="' + key + '"/><a href="javascript:void(0);">' + options[key].name + '</a></li>');
+ var checkbox = $('<li title="' + options[key].title + '"><input type="checkbox" name="' + key + '"/><a href="javascript:void(0);">' + options[key].name + '</a></li>');
+ if (options[key].sub){
+ checkbox.wrapInner("<ul/>");
+ }
if (getValue(key) === "true"){
checkbox.find('input').prop('checked',true);
}
@@ -13,13 +16,13 @@ leftcolumn.append('<div id="menuLeftHeader3"/>');
leftcolumn.append(menu.parent());
leftcolumn.append('<div class="menuLeftFooter"/>');
-$(document).on('change','ul.humpinator-options > li > input',function(){
+$(document).on('change','ul.humpinator-options li input',function(){
var key = $(this).attr('name');
var bool = $(this).is(":checked");
setValue(key,bool);
location.reload();
});
-$(document).on('click','ul.humpinator-options > li > a',function(){
+$(document).on('click','ul.humpinator-options li a',function(){
$(this).parent().find('input').trigger('click');
});
View
@@ -10,15 +10,24 @@ var setValue = function(k,v){
var options = {
"fitImages": {
"name": "Fit images on screen",
+ "title": "Scale images to fit in your browser to remove horizontal scrollbars.",
"value": true
},
"fullReplyForm": {
"name": "Full reply form",
+ "title": "Full reply form under the thread.",
"value": true
},
"instantQuotes": {
"name": "Instant quotes",
+ "title": "Quote a post without opening a new page.",
"value": true
+ },
+ "scrollAfterQuote": {
+ "name": "Scroll to reply form",
+ "title": "Scrolls to the bottom text field after successful quoting.",
+ "value": true,
+ "sub": true
}
};
var saveSettings = function(){
@@ -27,7 +36,6 @@ var saveSettings = function(){
}
};
if (!localStorage["humpinator-fitImages"]){
- console.log("initial");
saveSettings();
}
@@ -49,4 +57,8 @@ var fitImages = function(list, max_width, buffer){
wrapper.attr('href',img.attr('src')).attr('target','_blank');
}
});
-};
+};
+
+function scrollViewportTo(selector,time){
+ $('html, body').animate({scrollTop: $(selector).offset().top}, time);
+}

0 comments on commit c93f6c0

Please sign in to comment.