Skip to content

Commit 7444508

Browse files
authored
v2.2.0 merge (#331)
1 parent 2466994 commit 7444508

9 files changed

+226
-538
lines changed

README.md

+7-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[![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)
22

3-
### SOX v2.1.0
3+
### SOX v2.2.0
44

55
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.
66

@@ -16,9 +16,9 @@ Note: This project has no relation to Stack Overflow or Stack Exchange; it is si
1616
- 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>
1717
- 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>
1818

19-
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:
19+
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:
2020

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

2323
## What features are included?
2424

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

2929
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!
3030

31+
## Contribute
32+
33+
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.
34+
3135
## Changes
3236

3337
Please see the change log [at Stack Apps](http://stackapps.com/a/6358).

sox.common.js

+5-5
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@
129129
sox.error('SOX Error: BACKOFF: ' + d.backoff);
130130
} else if (d.error_id == 502) {
131131
sox.error('THROTTLE VIOLATION', d);
132-
} else if (d.error_id == 403) {
132+
} else if (d.error_id == 403) {
133133
sox.warn('Access token invalid! Opening window to get new one');
134134
window.open('https://stackexchange.com/oauth/dialog?client_id=7138&scope=no_expiry&redirect_uri=http://soscripted.github.io/sox/');
135135
alert('Your access token is no longer valid. A window has been opened to request a new one.');
@@ -271,9 +271,9 @@
271271
matchWithPattern: function(pattern, urlToMatchWith) { //commented version @ https://jsfiddle.net/shub01/t90kx2dv/
272272
if (pattern == 'SE1.0') { //SE.com && Area51.SE.com special checking
273273
if (urlToMatchWith) {
274-
if (urlToMatchWith.match(/https?:\/\/stackexchange\.com\/?/) || sox.location.matchWithPattern('*://area51.stackexchange.com/*')) return true;
274+
if (urlToMatchWith.match(/https?:\/\/stackexchange\.com\/?/) || (sox.location.matchWithPattern('*://area51.stackexchange.com/*') && sox.site.href.indexOf('.meta.') === -1)) return true;
275275
} else {
276-
if (location.href.match(/https?:\/\/stackexchange\.com\/?/) || sox.location.matchWithPattern('*://area51.stackexchange.com/*')) return true;
276+
if (location.href.match(/https?:\/\/stackexchange\.com\/?/) || (sox.location.matchWithPattern('*://area51.stackexchange.com/*') && sox.site.href.indexOf('.meta.') === -1)) return true;
277277
}
278278
return false;
279279
}
@@ -324,7 +324,7 @@
324324
if (sox.site.type == sox.site.types.chat) {
325325
return Chat.RoomUsers.current().name;
326326
} else {
327-
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');
327+
var $uname = $('.top-bar div.gravatar-wrapper-24'); //used to be $('body > div.topbar > div > div.topbar-links > a > div.gravatar-wrapper-24');
328328
return ($uname.length ? $uname.attr('title') : false);
329329
}
330330
},
@@ -340,4 +340,4 @@
340340
}
341341
};
342342

343-
})(window.sox = window.sox || {}, jQuery);
343+
})(window.sox = window.sox || {}, jQuery);

sox.css

+12-89
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,13 @@
22

33
#sox-settings-dialog {
44
top: 34px;
5-
left: 230px;
5+
right: 208px;
66
min-height: calc(100vh - 90px);
77
width: 550px;
88
display: none;
99
}
1010

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

@@ -208,16 +205,16 @@
208205
}
209206

210207
.metaNewQuestionAlert-diamondOn {
211-
background-position: -218px -86px;
208+
background-position: -218px -82px;
212209
}
213210

214211
.metaNewQuestionAlert-diamondOff {
215-
background-position: -138px -86px;
212+
background-position: -138px -82px;
216213
}
217214

218215
#metaNewQuestionAlertDialog {
219-
top: 34px;
220-
left: 264px;
216+
top: 50px;
217+
right: 242px;
221218
width: 377px;
222219
}
223220

@@ -403,64 +400,8 @@ li.fixedTopbar-siteLink {
403400
}
404401

405402

406-
/*enhancedEditor (enhanced_editor folder)*/
407-
408-
.enhancedEditor-centered {
409-
width: 40%;
410-
z-index: 1001;
411-
top: 190px;
412-
left: 615.5px;
413-
display: inline-block;
414-
margin-top: -95.5px;
415-
margin-left: -216px;
416-
overflow: auto;
417-
height: 70%;
418-
}
419-
420-
.ownURL, .ownImage {
421-
border-radius: 5px;
422-
width: 70%;
423-
padding: 5px;
424-
}
425-
426-
.go {
427-
padding: 5px;
428-
border-radius: 5px;
429-
color: black;
430-
background-color: lightgreen;
431-
}
432-
433-
.DDG-go {
434-
float: right;
435-
}
436-
437-
hr.or {
438-
border: 0;
439-
border-top: 1px solid whitesmoke;
440-
text-align: center;
441-
}
442-
443-
hr.or:after {
444-
content: "or...";
445-
display: inline-block;
446-
position: relative;
447-
top: -0.7em;
448-
font-size: 1.1em;
449-
padding: 0.2em;
450-
background: whitesmoke;
451-
}
452-
453-
.DDG-container {
454-
background-color: whitesmoke;
455-
border-radius: 10px;
456-
padding: 2%;
457-
}
458-
459-
.DDG-credit {
460-
font-size: 0.8em;
461-
}
462-
463-
.enhancedEditor-toolbar {
403+
/*findAndReplace*/
404+
.findReplaceToolbar {
464405
display: block;
465406
background-color: transparent;
466407
padding: 0 12px;
@@ -469,36 +410,20 @@ hr.or:after {
469410
border-top: 0;
470411
}
471412

472-
.enhancedEditor-toolbar>span {
473-
cursor: pointer;
474-
}
475-
476-
.enhancedEditor-toolbar>span+span {
477-
margin-left: 2px;
478-
}
479-
480-
.enhancedEditor-closeDialog {
481-
float: left;
482-
margin-right: 10px;
483-
font-size: 1.2em;
413+
#findReplace {
484414
cursor: pointer;
485415
}
486416

487-
.enhancedEditor-toolbar.findReplace>input[type='text'] {
417+
.findReplaceToolbar.findReplace>input[type='text'] {
488418
height: 10px;
489419
width: 25%;
490420
}
491421

492-
.enhancedEditor-toolbar.findReplace>input[type='button'] {
422+
.findReplaceToolbar.findReplace>input[type='button'] {
493423
width: 10%;
494424
height: 100%;
495425
}
496426

497-
.enhancedEditor-asLinkContainer {
498-
display: block;
499-
}
500-
501-
502427
/*chatEasyAccess - for the links (b elements)*/
503428

504429
.chatEasyAccess b {
@@ -528,10 +453,8 @@ hr.or:after {
528453

529454
#downvotedPostsEditAlertButton {
530455
background-image: none;
531-
padding-top: 10px;
532456
font-size: 14px;
533457
color: #858c93;
534-
height: 24px !important;
535458
min-width: 34px;
536459
cursor: pointer;
537460
}
@@ -553,8 +476,7 @@ hr.or:after {
553476
}
554477

555478
#downvotedPostsEditAlertDialog {
556-
top: 34px;
557-
left: 264px;
479+
right: 273px;
558480
width: 377px;
559481
display: none;
560482
}
@@ -569,6 +491,7 @@ hr.or:after {
569491

570492
.soxReplyLink {
571493
cursor: pointer;
494+
float: right;
572495
}
573496

574497

sox.dialog.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<div class="topbar-dialog achievements-dialog dno" id="sox-settings-dialog">
1+
<div class="topbar-dialog dno" id="sox-settings-dialog">
22
<div class="header">
33
<h3>
44
sox settings<span id="sox-settings-dialog-version"> v1.0.3dev</span>

sox.dialog.js

+15-53
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,10 @@
33

44
sox.dialog = {
55
init: function(options) {
6-
if (!$('.top-bar').length) return;
6+
7+
if (!$('.top-bar').length) {
8+
return;
9+
}
710
sox.debug('initializing SOX dialog');
811

912
var version = options.version,
@@ -255,50 +258,6 @@
255258
class: 'fa fa-cogs'
256259
});
257260

258-
//open dialog on hover if another dialog is already open
259-
$soxSettingsButton.hover(function() { //https://github.com/soscripted/sox/issues/44, open on hover, just like the normal dropdowns
260-
if ($('.topbar-icon').not('#soxSettingsButton').hasClass('topbar-icon-on')) {
261-
$('.topbar-dialog').hide();
262-
$('.topbar-icon-on').removeClass('topbar-icon-on').removeClass('icon-site-switcher-on');
263-
$(this).addClass('topbar-icon-on');
264-
$soxSettingsDialog.show();
265-
}
266-
}, function() {
267-
$('.topbar-icon').not('#soxSettingsButton').hover(function(e) {
268-
var $button = $(this);
269-
if ($('#soxSettingsButton').hasClass('topbar-icon-on')) {
270-
$soxSettingsDialog.hide();
271-
$('#soxSettingsButton').removeClass('topbar-icon-on');
272-
var which = $(this).attr('class').match(/js[\w-]*\b/)[0].split('-')[1];
273-
if (which != 'site') { //site-switcher dropdown is slightly different
274-
$('.' + which + '-dialog').not('#sox-settings-dialog, #metaNewQuestionAlertDialog, #downvotedPostsEditAlertDialog').show();
275-
$(this).addClass('topbar-icon-on');
276-
//repeated clicks are INTENDED, hacky fix for https://github.com/soscripted/sox/issues/272
277-
$button[0].click();
278-
$button[0].click();
279-
} else {
280-
if ($(this).css('top') != '34px') {
281-
$('.siteSwitcher-dialog').css('top', '34px').css('left', '0px');
282-
}
283-
$('.siteSwitcher-dialog').show();
284-
$(this).addClass('topbar-icon-on').addClass('icon-site-switcher-on'); //icon-site-switcher-on is special to the site-switcher dropdown (StackExchange button)
285-
}
286-
} else {
287-
if (!$(e.toElement).is('.icon-site-switcher')) {
288-
if ($('.siteSwitcher-dialog').is(':visible')) {
289-
$('.siteSwitcher-dialog').hide();
290-
}
291-
}
292-
}
293-
}, function(e) {
294-
if ($(e.toElement).is('.topbar-icon')) { //only hide the StackExchange dialog if the un-hover is onto another topbar dialog button
295-
if ($('.siteSwitcher-dialog').is(':visible')) {
296-
$('.siteSwitcher-dialog').hide();
297-
}
298-
}
299-
});
300-
});
301-
302261
//close dialog if clicked outside it
303262
$(document).click(function(e) { //close dialog if clicked outside it
304263
var $target = $(e.target),
@@ -347,14 +306,17 @@
347306

348307
// add dialog to corral and sox button to topbar
349308
$soxSettingsButton.append($icon);
350-
if (sox.NEW_TOPBAR) {
351-
console.log('asd');
352-
$('.secondary-nav .-list').prepend($('<li/>').addClass('-item').append($soxSettingsButton));
353-
$soxSettingsDialog.addClass('new-topbar');
354-
} else {
355-
$soxSettingsButton.appendTo('div.network-items');
356-
$soxSettingsDialog.css('left', $('#soxSettingsButton').position().left);
309+
$('.top-bar .-container .-secondary .-item:eq(1)').after($('<li/>').addClass('-item').append($soxSettingsButton)); //https://github.com/soscripted/sox/issues/310
310+
if (sox.site.href.indexOf('area51.meta') !== -1) { //area 51 discussions is different
311+
$soxSettingsButton.parent().css({
312+
'top': '7px',
313+
'left': '9px'
314+
});
357315
}
316+
$soxSettingsDialog.addClass('new-topbar');
317+
$soxSettingsDialog.css('top', $('.top-bar').height());
318+
319+
358320

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

366-
})(window.sox = window.sox || {}, jQuery);
328+
})(window.sox = window.sox || {}, jQuery);

0 commit comments

Comments
 (0)