Skip to content

Commit

Permalink
v2.2.0 merge (#331)
Browse files Browse the repository at this point in the history
  • Loading branch information
shu8 authored Jun 15, 2018
1 parent 2466994 commit 7444508
Show file tree
Hide file tree
Showing 9 changed files with 226 additions and 538 deletions.
10 changes: 7 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[![Join the chat at https://gitter.im/soscripted/sox](https://badges.gitter.im/soscripted/sox.svg)](https://gitter.im/soscripted/sox?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)

### SOX v2.1.0
### SOX v2.2.0

Stack Overflow Extras (*SOX*) is a project that stemmed from the [Stack Overflow Optional Features (SOOF)](https://github.com/shu8/Stack-Overflow-Optional-Features) project.

Expand All @@ -16,9 +16,9 @@ Note: This project has no relation to Stack Overflow or Stack Exchange; it is si
- Official Version: <kbd>[install](https://github.com/soscripted/sox/raw/v2.1.0/sox.user.js)</kbd>. <kbd>[view source](https://github.com/soscripted/sox/blob/v2.1.0/sox.user.js)</kbd>
- Development Version: <kbd>[install](https://github.com/soscripted/sox/raw/dev/sox.user.js)</kbd>. <kbd>[view source](https://github.com/soscripted/sox/blob/dev/sox.user.js)</kbd>

3. Go to any site in the Stack Exchange Network (eg. [Super User](http://superuser.com/) or [Stack Overflow](http://stackoverflow.com/)). You will automatically be asked to choose and save your settings. A toggle button (gears icon) will be added to your topbar where you can change these later on:
3. Go to any site in the Stack Exchange Network (e.g. [Super User](http://superuser.com/) or [Stack Overflow](http://stackoverflow.com/)). You will automatically be asked to choose and save your settings. A toggle button (gears icon) will be added to your topbar where you can change these later on:

![newdialog](https://cloud.githubusercontent.com/assets/12533449/14296194/c732b1b2-fb2d-11e5-9563-1e34b12eada9.png)
![newdialog](https://i.stack.imgur.com/q93pM.jpg)

## What features are included?

Expand All @@ -28,6 +28,10 @@ A full list of all the features is available on the SOX wiki page [here](https:/

Please post bugs and feature requests as issues on [Github](https://github.com/soscripted/sox), where we can track them easily and push updates quickly. Please **do not** post them as answers on Stack Apps -- they are much harder to manage!

## Contribute

Pull requests to add new features or improve the existing ones, etc. are welcome! Please head to the [Contributing](https://github.com/soscripted/sox/wiki/Contributing) wiki page to get started.

## Changes

Please see the change log [at Stack Apps](http://stackapps.com/a/6358).
10 changes: 5 additions & 5 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 @@ -271,9 +271,9 @@
matchWithPattern: function(pattern, urlToMatchWith) { //commented version @ https://jsfiddle.net/shub01/t90kx2dv/
if (pattern == 'SE1.0') { //SE.com && Area51.SE.com special checking
if (urlToMatchWith) {
if (urlToMatchWith.match(/https?:\/\/stackexchange\.com\/?/) || sox.location.matchWithPattern('*://area51.stackexchange.com/*')) return true;
if (urlToMatchWith.match(/https?:\/\/stackexchange\.com\/?/) || (sox.location.matchWithPattern('*://area51.stackexchange.com/*') && sox.site.href.indexOf('.meta.') === -1)) return true;
} else {
if (location.href.match(/https?:\/\/stackexchange\.com\/?/) || sox.location.matchWithPattern('*://area51.stackexchange.com/*')) return true;
if (location.href.match(/https?:\/\/stackexchange\.com\/?/) || (sox.location.matchWithPattern('*://area51.stackexchange.com/*') && sox.site.href.indexOf('.meta.') === -1)) return true;
}
return false;
}
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 = $('.top-bar div.gravatar-wrapper-24'); //used to be $('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);
101 changes: 12 additions & 89 deletions sox.css
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,13 @@

#sox-settings-dialog {
top: 34px;
left: 230px;
right: 208px;
min-height: calc(100vh - 90px);
width: 550px;
display: none;
}

#sox-settings-dialog.new-topbar {
right: 192px;
left: inherit !important;
top: 50px;
min-height: calc(100vh - 75px);
}

Expand Down Expand Up @@ -208,16 +205,16 @@
}

.metaNewQuestionAlert-diamondOn {
background-position: -218px -86px;
background-position: -218px -82px;
}

.metaNewQuestionAlert-diamondOff {
background-position: -138px -86px;
background-position: -138px -82px;
}

#metaNewQuestionAlertDialog {
top: 34px;
left: 264px;
top: 50px;
right: 242px;
width: 377px;
}

Expand Down Expand Up @@ -403,64 +400,8 @@ li.fixedTopbar-siteLink {
}


/*enhancedEditor (enhanced_editor folder)*/

.enhancedEditor-centered {
width: 40%;
z-index: 1001;
top: 190px;
left: 615.5px;
display: inline-block;
margin-top: -95.5px;
margin-left: -216px;
overflow: auto;
height: 70%;
}

.ownURL, .ownImage {
border-radius: 5px;
width: 70%;
padding: 5px;
}

.go {
padding: 5px;
border-radius: 5px;
color: black;
background-color: lightgreen;
}

.DDG-go {
float: right;
}

hr.or {
border: 0;
border-top: 1px solid whitesmoke;
text-align: center;
}

hr.or:after {
content: "or...";
display: inline-block;
position: relative;
top: -0.7em;
font-size: 1.1em;
padding: 0.2em;
background: whitesmoke;
}

.DDG-container {
background-color: whitesmoke;
border-radius: 10px;
padding: 2%;
}

.DDG-credit {
font-size: 0.8em;
}

.enhancedEditor-toolbar {
/*findAndReplace*/
.findReplaceToolbar {
display: block;
background-color: transparent;
padding: 0 12px;
Expand All @@ -469,36 +410,20 @@ hr.or:after {
border-top: 0;
}

.enhancedEditor-toolbar>span {
cursor: pointer;
}

.enhancedEditor-toolbar>span+span {
margin-left: 2px;
}

.enhancedEditor-closeDialog {
float: left;
margin-right: 10px;
font-size: 1.2em;
#findReplace {
cursor: pointer;
}

.enhancedEditor-toolbar.findReplace>input[type='text'] {
.findReplaceToolbar.findReplace>input[type='text'] {
height: 10px;
width: 25%;
}

.enhancedEditor-toolbar.findReplace>input[type='button'] {
.findReplaceToolbar.findReplace>input[type='button'] {
width: 10%;
height: 100%;
}

.enhancedEditor-asLinkContainer {
display: block;
}


/*chatEasyAccess - for the links (b elements)*/

.chatEasyAccess b {
Expand Down Expand Up @@ -528,10 +453,8 @@ hr.or:after {

#downvotedPostsEditAlertButton {
background-image: none;
padding-top: 10px;
font-size: 14px;
color: #858c93;
height: 24px !important;
min-width: 34px;
cursor: pointer;
}
Expand All @@ -553,8 +476,7 @@ hr.or:after {
}

#downvotedPostsEditAlertDialog {
top: 34px;
left: 264px;
right: 273px;
width: 377px;
display: none;
}
Expand All @@ -569,6 +491,7 @@ hr.or:after {

.soxReplyLink {
cursor: pointer;
float: right;
}


Expand Down
2 changes: 1 addition & 1 deletion sox.dialog.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<div class="topbar-dialog achievements-dialog dno" id="sox-settings-dialog">
<div class="topbar-dialog dno" id="sox-settings-dialog">
<div class="header">
<h3>
sox settings<span id="sox-settings-dialog-version"> v1.0.3dev</span>
Expand Down
68 changes: 15 additions & 53 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 @@ -255,50 +258,6 @@
class: 'fa fa-cogs'
});

//open dialog on hover if another dialog is already open
$soxSettingsButton.hover(function() { //https://github.com/soscripted/sox/issues/44, open on hover, just like the normal dropdowns
if ($('.topbar-icon').not('#soxSettingsButton').hasClass('topbar-icon-on')) {
$('.topbar-dialog').hide();
$('.topbar-icon-on').removeClass('topbar-icon-on').removeClass('icon-site-switcher-on');
$(this).addClass('topbar-icon-on');
$soxSettingsDialog.show();
}
}, function() {
$('.topbar-icon').not('#soxSettingsButton').hover(function(e) {
var $button = $(this);
if ($('#soxSettingsButton').hasClass('topbar-icon-on')) {
$soxSettingsDialog.hide();
$('#soxSettingsButton').removeClass('topbar-icon-on');
var which = $(this).attr('class').match(/js[\w-]*\b/)[0].split('-')[1];
if (which != 'site') { //site-switcher dropdown is slightly different
$('.' + which + '-dialog').not('#sox-settings-dialog, #metaNewQuestionAlertDialog, #downvotedPostsEditAlertDialog').show();
$(this).addClass('topbar-icon-on');
//repeated clicks are INTENDED, hacky fix for https://github.com/soscripted/sox/issues/272
$button[0].click();
$button[0].click();
} else {
if ($(this).css('top') != '34px') {
$('.siteSwitcher-dialog').css('top', '34px').css('left', '0px');
}
$('.siteSwitcher-dialog').show();
$(this).addClass('topbar-icon-on').addClass('icon-site-switcher-on'); //icon-site-switcher-on is special to the site-switcher dropdown (StackExchange button)
}
} else {
if (!$(e.toElement).is('.icon-site-switcher')) {
if ($('.siteSwitcher-dialog').is(':visible')) {
$('.siteSwitcher-dialog').hide();
}
}
}
}, function(e) {
if ($(e.toElement).is('.topbar-icon')) { //only hide the StackExchange dialog if the un-hover is onto another topbar dialog button
if ($('.siteSwitcher-dialog').is(':visible')) {
$('.siteSwitcher-dialog').hide();
}
}
});
});

//close dialog if clicked outside it
$(document).click(function(e) { //close dialog if clicked outside it
var $target = $(e.target),
Expand Down Expand Up @@ -347,14 +306,17 @@

// add dialog to corral and sox button to topbar
$soxSettingsButton.append($icon);
if (sox.NEW_TOPBAR) {
console.log('asd');
$('.secondary-nav .-list').prepend($('<li/>').addClass('-item').append($soxSettingsButton));
$soxSettingsDialog.addClass('new-topbar');
} else {
$soxSettingsButton.appendTo('div.network-items');
$soxSettingsDialog.css('left', $('#soxSettingsButton').position().left);
$('.top-bar .-container .-secondary .-item:eq(1)').after($('<li/>').addClass('-item').append($soxSettingsButton)); //https://github.com/soscripted/sox/issues/310
if (sox.site.href.indexOf('area51.meta') !== -1) { //area 51 discussions is different
$soxSettingsButton.parent().css({
'top': '7px',
'left': '9px'
});
}
$soxSettingsDialog.addClass('new-topbar');
$soxSettingsDialog.css('top', $('.top-bar').height());



//'$('#soxSettingsButton').position().left' from @IStoleThePies: https://github.com/soscripted/sox/issues/120#issuecomment-267857625:
//only add dialog if button was added successfully
Expand All @@ -363,4 +325,4 @@
}
};

})(window.sox = window.sox || {}, jQuery);
})(window.sox = window.sox || {}, jQuery);
Loading

0 comments on commit 7444508

Please sign in to comment.