Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
shu8 committed May 6, 2018
1 parent e81d797 commit 4e1a902
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 23 deletions.
6 changes: 3 additions & 3 deletions sox.common.js
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@
sox.error('SOX Error: BACKOFF: ' + d.backoff);
} else if (d.error_id == 502) {
sox.error('THROTTLE VIOLATION', d);
} else if (d.error_id == 403) {
} else if (d.error_id == 403) {
sox.warn('Access token invalid! Opening window to get new one');
window.open('https://stackexchange.com/oauth/dialog?client_id=7138&scope=no_expiry&redirect_uri=http://soscripted.github.io/sox/');
alert('Your access token is no longer valid. A window has been opened to request a new one.');
Expand Down Expand Up @@ -324,7 +324,7 @@
if (sox.site.type == sox.site.types.chat) {
return Chat.RoomUsers.current().name;
} else {
var $uname = sox.NEW_TOPBAR ? $('body > header > div > div.-actions > a > div.gravatar-wrapper-24') : $('body > div.topbar > div > div.topbar-links > a > div.gravatar-wrapper-24');
var $uname = sox.NEW_TOPBAR ? $('.top-bar div.gravatar-wrapper-24') : $('body > div.topbar > div > div.topbar-links > a > div.gravatar-wrapper-24');
return ($uname.length ? $uname.attr('title') : false);
}
},
Expand All @@ -340,4 +340,4 @@
}
};

})(window.sox = window.sox || {}, jQuery);
})(window.sox = window.sox || {}, jQuery);
9 changes: 6 additions & 3 deletions sox.dialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@

sox.dialog = {
init: function(options) {
if (!$('.top-bar').length) return;

if (!$('.top-bar').length) {
return;
}
sox.debug('initializing SOX dialog');

var version = options.version,
Expand Down Expand Up @@ -304,7 +307,7 @@
// add dialog to corral and sox button to topbar
$soxSettingsButton.append($icon);
if (sox.NEW_TOPBAR) {
$('.-actions .secondary-nav .-list').prepend($('<li/>').addClass('-item').append($soxSettingsButton)); //https://github.com/soscripted/sox/issues/310
$('.top-bar .-container .-secondary .-item:eq(1)').after($('<li/>').addClass('-item').append($soxSettingsButton)); //https://github.com/soscripted/sox/issues/310
$soxSettingsDialog.addClass('new-topbar');
} else {
$soxSettingsButton.appendTo('div.network-items');
Expand All @@ -318,4 +321,4 @@
}
};

})(window.sox = window.sox || {}, jQuery);
})(window.sox = window.sox || {}, jQuery);
2 changes: 1 addition & 1 deletion sox.features.info.json
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@
}, {
"name": "editComment",
"desc": "Pre-defined edit comment options (checkboxes)",
"extended_description": "Adds checkboxes to add canned messages for edit revisions when editing. You can make your own canned responses by clicking the 'Edit Reasons' button that is added to the Help dropdown menu in the topbar",
"extended_description": "Adds checkboxes to add canned messages for edit revisions when editing. You can make *your own* canned responses by clicking the 'Edit Reasons' button that is added to the Help dropdown menu in the topbar",
"meta": "http://meta.stackexchange.com/questions/190461/improve-the-editing-flow-with-predefined-options-for-edit-summary",
"match": "",
"exclude": "*://chat.*.com/*,SE1.0"
Expand Down
31 changes: 17 additions & 14 deletions sox.features.js
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,10 @@

function colour() {
$('.answercell').each(function(i, obj) {
$(this).parent().next().find('.comment-user:contains("' + $.trim($(this).find('.user-details').last().clone().children('.-flair').remove().end().text()) + '")').css({'background-color': '#f9e2b6', 'padding': '1px 5px'}); //Find the comments on each post that contain the answerer's name. Also, .last() is necessary, or else it will use the name of someone who edits the answer.
$(this).parent().next().find('.comment-user:contains("' + $.trim($(this).find('.user-details').last().clone().children('.-flair').remove().end().text()) + '")').css({
'background-color': '#f9e2b6',
'padding': '1px 5px'
}); //Find the comments on each post that contain the answerer's name. Also, .last() is necessary, or else it will use the name of someone who edits the answer.
});
}

Expand Down Expand Up @@ -489,7 +492,7 @@
var popup = $('.share-tip');
var origHtml = popup.html();
if (origHtml.indexOf(toRemove) == -1) return; //don't do anything if the function's already done its thing
popup.html(function () {
popup.html(function() {
return origHtml.replace(toRemove, '');
});

Expand Down Expand Up @@ -1595,7 +1598,7 @@ Toggle SBS?</div></li>';
// Description: Hide just the 'Hot Meta Posts' sections in the Community Bulletin

var $hotMetaPostsHeader = $('#sidebar .community-bulletin .related').find('div:contains("Hot Meta Posts")');
if($hotMetaPostsHeader.length) {
if ($hotMetaPostsHeader.length) {
$hotMetaPostsHeader.nextAll().remove();
$hotMetaPostsHeader.remove();
}
Expand Down Expand Up @@ -2433,8 +2436,8 @@ Toggle SBS?</div></li>';

var div = $('<div/>', {
id: 'loggedInReminder',
style: 'position: fixed; right: 0; bottom: 50px; background-color: rgba(200, 200, 200, 1); width: 200px; height: 35px; text-align: center; padding: 3px; color: red;',
html: 'You are not logged in. You should <a href="/users/login">log in</a> to continue enjoying SE.'
style: 'position: fixed; right: 0; bottom: 50px; background-color: rgba(200, 200, 200, 1); width: 200px; text-align: center; padding: 5px; color: black; font-weight:bold',
html: 'SOX: You are not logged in. You should <a href="/users/login">log in</a> to continue enjoying SE.'
});

function checkAndAddReminder() {
Expand Down Expand Up @@ -2483,15 +2486,15 @@ Toggle SBS?</div></li>';
var $timeSpan = $(this).find('.user-action-time:first span:last'),
lastEditedTime = new Date($timeSpan.attr('title')),
timeDifference = new Date() - lastEditedTime;
if (timeDifference/1000/60 > 5) { //divide by 1000 to get seconds, divide by 60 to get minutes
if (timeDifference / 1000 / 60 > 5) { //divide by 1000 to get seconds, divide by 60 to get minutes
$(this).find('.votecell .vote a[class*="vote"]')
.not('[id*="vote-accept"]')
.removeClass('sox-better-css')
.css({
'cursor': 'default',
'opacity': '0.5',
'pointer-events': 'none' //disables the anchor tag (jQuery off() doesn't work)
});
.not('[id*="vote-accept"]')
.removeClass('sox-better-css')
.css({
'cursor': 'default',
'opacity': '0.5',
'pointer-events': 'none' //disables the anchor tag (jQuery off() doesn't work)
});
$(this).find('.vote').attr('title', 'You cannot change your vote on posts that were last edited more than 5 minutes ago.');
}
}
Expand Down Expand Up @@ -2762,4 +2765,4 @@ Toggle SBS?</div></li>';
});
}
};
})(window.sox = window.sox || {}, jQuery);
})(window.sox = window.sox || {}, jQuery);
5 changes: 3 additions & 2 deletions sox.user.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// ==UserScript==
// @name Stack Overflow Extras (SOX)
// @namespace https://github.com/soscripted/sox
// @version 2.1.7 DEV
// @version 2.1.8 DEV
// @description Extra optional features for Stack Overflow and Stack Exchange sites
// @contributor ᴉʞuǝ (stackoverflow.com/users/1454538/)
// @contributor ᔕᖺᘎᕊ (stackexchange.com/users/4337810/)
Expand Down Expand Up @@ -92,6 +92,7 @@
featureInfo = JSON.parse(GM_getResourceText('featuresJSON'));

try {
sox.debug('init', sox, sox.dialog);
sox.dialog.init({
version: sox.info.version,
features: featureInfo,
Expand Down Expand Up @@ -199,4 +200,4 @@
}
}
sox.ready(init);
})(window.sox = window.sox || {}, jQuery);
})(window.sox = window.sox || {}, jQuery);

0 comments on commit 4e1a902

Please sign in to comment.