Skip to content

Commit a154ed3

Browse files
committed
🐛 Rewrite after site changes (fixes jerone#103) (jerone#107)
🐛 Rewrite after site changes (fixes jerone#103)
1 parent 03abedc commit a154ed3

2 files changed

Lines changed: 68 additions & 61 deletions

File tree

Multiple_Windows_Live_IDs/Multiple_Windows_Live_IDs.user.js

Lines changed: 49 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
// @updateURL https://github.com/jerone/UserScripts/raw/master/Multiple_Windows_Live_IDs/Multiple_Windows_Live_IDs.user.js
1313
// @supportURL https://github.com/jerone/UserScripts/issues
1414
// @contributionURL https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=VCYMHWQ7ZMBKW
15-
// @version 0.1.2
15+
// @version 0.2.0
1616
// @grant GM_getValue
1717
// @grant GM_setValue
1818
// @run-at document-end
@@ -98,41 +98,37 @@
9898
var metroColors = ["#00AEDB", "#00B159", "#F37735", "#7C4199", "#FFC425", "#EC098C", "#D11141", "#000000"], metroColorsIndex = -1;
9999

100100
var css =
101-
// hide ad;
102-
"#brandModeTD { display:none; }" +
101+
// layout;
102+
"#maincontent, #accountTD { display: inline-block; }" +
103103

104104
// accounts;
105-
"#accountTD { font-size: 12px; width: 475px; }" +
106-
"#accountTD .profile { text-transform: uppercase; color: #FFFFFF; cursor: pointer; float: left; height: 138px; position: relative; margin: 5px; padding: 5px; line-height: 150px; text-align: center; width: 138px; }" +
105+
"#accountTD { font-size: 12px; width: 500px; min-height: 400px; margin: 5px; }" +
106+
"#accountTD .profile { text-transform: uppercase; color: #FFFFFF; cursor: pointer; float: left; height: 150px; position: relative; margin: 5px; padding: 5px; text-align: center; width: 150px; }" +
107107
"#accountTD .profile:hover{ opacity: 0.85; }" +
108108
"#accountTD .profile.dark { color: #000000; }" +
109-
"#accountTD .profile > img { margin-bottom: 30px; max-height: 100px; max-width: 100px; vertical-align: middle; }" +
110-
"#accountTD .profile > span { bottom: 0; left: 0; margin: 5px; overflow: hidden; position: absolute; text-overflow: ellipsis; white-space: nowrap; width: 138px; }" +
109+
"#accountTD .profile > img { max-height: 100px; max-width: 100px; vertical-align: middle; }" +
110+
"#accountTD .profile > span { bottom: 0; left: 0; margin: 5px; overflow: hidden; position: absolute; text-overflow: ellipsis; white-space: nowrap; width: 140px; }" +
111111
"#accountTD .profile > div { display: none; position: absolute; right: 0; top: 0; }" +
112112
"#accountTD .profile > div img { opacity: 0.3; margin: 4px 4px 0 0; }" +
113113
"#accountTD .profile:hover > div { display: block; }" +
114114
"#accountTD .profile:hover > div img:hover { opacity: 1; }" +
115115

116116
// add account button;
117-
"#accountTD .addAccountBtn { opacity: 0.6; width: 88px; height: 88px; }" +
117+
"#accountTD .addAccountBtn { opacity: 0.6; width: 100px; height: 100px; }" +
118118
"#accountTD .addAccountBtn:hover { opacity: 1; }" +
119-
"#accountTD .addAccountBtn > img { margin-bottom: 80px; max-height: 40px; max-width: 40px; }" +
120-
"#accountTD .addAccountBtn > span { width: 88px; }" +
119+
"#accountTD .addAccountBtn > img { max-height: 40px; max-width: 40px; }" +
120+
"#accountTD .addAccountBtn > span { width: 90px; }" +
121121
"#accountTD .addAccountBtn > div { float: right; }" +
122122

123123
// edit account;
124-
"#editAccountTD { display: none; width: 420px; position: relative; }" +
124+
"#editAccountTD { display: none; position: relative; }" +
125125
"#editAccountTD .signInHeader img { position: relative; left: -34px; }" +
126-
"#editAccountTD .phholder { position: absolute; top: 0px; left: 0px; z-index: 5; width: 100%; cursor: text; }" +
127-
"#editAccountTD .row.textbox { position: relative; width: 100%; }" +
128-
"#editAccountTD .errorDiv { display: none; }" +
126+
"#editAccountTD .phholder { left: 0px; top: 0px; width: 100%; position: absolute; z-index: 5; cursor: text; }" +
127+
"#editAccountTD .alert-error { display: none; }" +
129128
"#editAccountCancel { background-color: #D11141; margin-left: 8px; }" +
130129

131130
// password mask;
132-
".passMask { position: absolute; right: 8px; top: 8px; width: 16px; height: 16px; cursor: pointer; }" +
133-
134-
// fix for Microsoft login;
135-
".placeholder { margin: 6px 9px; }";
131+
".passMask { position: absolute; right: 8px; top: 8px; width: 16px; height: 16px; cursor: pointer; }";
136132
var stylesheet = document.createElement("style");
137133
stylesheet.type = "text/css";
138134
if (stylesheet.styleSheet) {
@@ -144,10 +140,9 @@
144140

145141
var accountTD = document.createElement("div");
146142
accountTD.id = "accountTD";
147-
accountTD.classList.add("floatLeft");
148143

149-
var mainTD = document.getElementById("mainTD");
150-
mainTD.insertBefore(accountTD, mainTD.firstChild);
144+
var mainTD = document.getElementById("maincontent");
145+
mainTD.parentNode.insertBefore(accountTD, mainTD);
151146

152147
function paint() {
153148
profiles.forEach(function(profile, i) {
@@ -163,14 +158,10 @@
163158
profileDiv.style.backgroundColor = profile.color;
164159
profileDiv.addEventListener("click", proxy(function(_event, _profile) {
165160
document.getElementById("i0116").value = _profile.mail;
161+
fireEvent(document.getElementById("i0116"), "change");
166162

167-
var idDiv_PWD_UsernameExample = document.getElementById("idDiv_PWD_UsernameExample");
168-
if (idDiv_PWD_UsernameExample) { idDiv_PWD_UsernameExample.style.display = "none"; }
169-
170-
document.getElementById("i0118").value = _profile.pass;
171-
172-
var idDiv_PWD_PasswordExample = document.getElementById("idDiv_PWD_PasswordExample");
173-
if (idDiv_PWD_PasswordExample) { idDiv_PWD_PasswordExample.style.display = "none"; }
163+
document.getElementById("i0118").value = _profile.pass;
164+
fireEvent(document.getElementById("i0118"), "change");
174165

175166
if (autoLogin) {
176167
document.getElementById("idSIButton9").click();
@@ -239,7 +230,7 @@
239230
profileManageEdit.addEventListener("click", proxy(function(_event, _profile, _i) {
240231
_event.stopPropagation();
241232

242-
document.getElementById("signInTD").style.display = "none";
233+
document.querySelector("#maincontent > section").style.display = "none";
243234

244235
document.getElementById("editAccountTD").style.display = "block";
245236

@@ -275,7 +266,7 @@
275266
addAccountBtnDiv.setAttribute("title", "Add account");
276267
addAccountBtnDiv.style.backgroundColor = "#0072C6";
277268
addAccountBtnDiv.addEventListener("click", function() {
278-
document.getElementById("signInTD").style.display = "none";
269+
document.querySelector("#maincontent > section").style.display = "none";
279270

280271
document.getElementById("editAccountTD").style.display = "block";
281272

@@ -311,21 +302,26 @@
311302
'<div id="i0272" class="signInHeader" style="height: 80px;">' +
312303
'<h1><img src="' + image.header + '" alt="Multiple Windows Live IDs" /></h1>' +
313304
'</div>' +
314-
'<div style="width: 100px; height: ' + ((document.getElementById("signInTD").offsetHeight || 500) - 120) + 'px;" class="floatLeft"><input id="editAccountId" type="hidden" /></div>' +
315-
'<div style="width: 320px;" class="floatLeft">' +
316-
'<div class="section">' +
317-
'<div id="editAccountHeader1" class="row label">Add account</div>' +
318-
'<div id="editAccountHeader2" class="row label">Edit account</div>' +
319-
'<div class="row textbox"><input id="editAccountName" type="text" ><div class="phholder"><div class="placeholder">Name</div></div></div>' +
320-
'<div class="errorDiv" id="editAccountMailError">Please enter your email address in the format someone@example.com.</div>' +
321-
'<div class="row textbox"><input id="editAccountMail" type="email" ><div class="phholder"><div class="placeholder">someone@example.com</div></div></div>' +
322-
'<div class="errorDiv" id="editAccountPassError">Please enter the password for your Microsoft account.</div>' +
323-
'<div class="row textbox"><input id="editAccountPass" type="password"><div class="phholder"><div class="placeholder">Password</div></div></div>' +
324-
'<div class="row textbox"><input id="editAccountPhoto" type="text" ><div class="phholder"><div class="placeholder">http://my.pictu.re/img.png</div></div></div>' +
325-
'<div class="row textbox"><input id="editAccountColor" type="text" ><div class="phholder"><div class="placeholder">#AB12CD</div></div></div>' +
305+
'<input id="editAccountId" type="hidden" />' +
306+
'<div>' +
307+
'<div>' +
308+
'<div id="editAccountHeader1" class="row text-subheader">Add account</div>' +
309+
'<div id="editAccountHeader2" class="row text-subheader">Edit account</div>' +
310+
'<div class="form-group">'+
311+
' <div class="placeholderContainer"><input id="editAccountName" class="form-control" type="text" /><div class="phholder"><div class="placeholder">Name</div></div></div></div>' +
312+
'<div class="form-group">'+
313+
' <div class="alert alert-error" id="editAccountMailError">Please enter your email address in the format someone@example.com.</div>' +
314+
' <div class="placeholderContainer"><input id="editAccountMail" class="form-control" type="email" /><div class="phholder"><div class="placeholder">someone@example.com</div></div></div></div>' +
315+
'<div class="form-group">'+
316+
' <div class="alert alert-error" id="editAccountPassError">Please enter the password for your Microsoft account.</div>' +
317+
' <div class="placeholderContainer"><input id="editAccountPass" class="form-control" type="password"/><div class="phholder"><div class="placeholder">Password</div></div></div></div>' +
318+
'<div class="form-group">'+
319+
' <div class="placeholderContainer"><input id="editAccountPhoto" class="form-control" type="text" /><div class="phholder"><div class="placeholder">http://my.pictu.re/img.png</div></div></div></div>' +
320+
'<div class="form-group">'+
321+
' <div class="placeholderContainer"><input id="editAccountColor" class="form-control" type="text" /><div class="phholder"><div class="placeholder">#AB12CD</div></div></div></div>' +
326322
'</div>' +
327-
'<div class="section"><input id="editAccountSubmit" value="Submit" class="default" type="submit"><input id="editAccountCancel" value="Cancel" class="default" type="submit"></div>' +
328-
'<div class="signUpFloat">Multiple Windows Live IDs. <a class="TextSemiBold" href="https://github.com/jerone/UserScripts/tree/master/Multiple_Windows_Live_IDs" target="_blank">More info...</a></div>' +
323+
'<div class="section"><input id="editAccountSubmit" value="Submit" class="default" type="submit"/><input id="editAccountCancel" value="Cancel" class="default" type="submit"/></div>' +
324+
'<div class="section">Multiple Windows Live IDs. <a class="TextSemiBold" href="https://github.com/jerone/UserScripts/tree/master/Multiple_Windows_Live_IDs" target="_blank">More info...</a></div>' +
329325
'</div>';
330326
mainTD.appendChild(editAccountDiv);
331327

@@ -350,7 +346,9 @@
350346

351347
if (addPassMask) { addPassMaskFn(editAccountPass); }
352348

353-
document.getElementById("editAccountSubmit").addEventListener("click", function() {
349+
document.getElementById("editAccountSubmit").addEventListener("click", function(e) {
350+
e.preventDefault();
351+
354352
editAccountMailError.style.display = !editAccountMail.value ? "block" : "none";
355353
editAccountPassError.style.display = !editAccountPass.value ? "block" : "none";
356354

@@ -369,15 +367,17 @@
369367

370368
repaint();
371369

372-
document.getElementById("signInTD").style.display = "block";
370+
document.querySelector("#maincontent > section").style.display = "block";
373371

374372
document.getElementById("editAccountTD").style.display = "none";
375373

376374
setAccount();
377375
});
378376

379-
document.getElementById("editAccountCancel").addEventListener("click", function() {
380-
document.getElementById("signInTD").style.display = "block";
377+
document.getElementById("editAccountCancel").addEventListener("click", function(e) {
378+
e.preventDefault();
379+
380+
document.querySelector("#maincontent > section").style.display = "block";
381381

382382
document.getElementById("editAccountTD").style.display = "none";
383383

@@ -390,7 +390,7 @@
390390
editAccountHeader1.style.display = !id ? "block" : "none";
391391
editAccountHeader2.style.display = id ? "block" : "none";
392392

393-
editAccountId.value = id || -1;
393+
editAccountId.value = id != null ? id : -1;
394394
editAccountName.value = profile.name || "";
395395
editAccountMail.value = profile.mail || "";
396396
editAccountPass.value = profile.pass || "";

Multiple_Windows_Live_IDs/README.md

Lines changed: 19 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,35 +5,42 @@
55
[![Donate](https://raw.github.com/jerone/UserScripts/master/_resources/Donate-button.png)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=VCYMHWQ7ZMBKW)
66
[![Support](https://raw.github.com/jerone/UserScripts/master/_resources/Support-button.png)](https://github.com/jerone/UserScripts/issues)
77

8-
98
## Description
109

1110
Easy login with multiple Microsoft accounts.
1211

13-
1412
## Screenshot
1513

1614
### View
15+
1716
![Multiple Windows Live IDs view screenshot](https://github.com/jerone/UserScripts/raw/master/Multiple_Windows_Live_IDs/screenshot_view_v1.jpg)
17+
1818
### Edit
19-
![Multiple Windows Live IDs edit screenshot](https://github.com/jerone/UserScripts/raw/master/Multiple_Windows_Live_IDs/screenshot_edit_v1.jpg)
2019

20+
![Multiple Windows Live IDs edit screenshot](https://github.com/jerone/UserScripts/raw/master/Multiple_Windows_Live_IDs/screenshot_edit_v1.jpg)
2121

2222
## Compatible
2323

24-
* [![](https://raw.github.com/jerone/UserScripts/master/_resources/Greasemonkey.png) Greasemonkey](https://addons.mozilla.org/firefox/addon/greasemonkey/) on [![](https://raw.github.com/jerone/UserScripts/master/_resources/Firefox.png) Mozilla Firefox](http://www.mozilla.org/en-US/firefox/fx/#desktop) desktop.
25-
24+
* ![](https://raw.github.com/jerone/UserScripts/master/_resources/Greasemonkey.png) [Greasemonkey](https://addons.mozilla.org/firefox/addon/greasemonkey/) on ![](https://raw.github.com/jerone/UserScripts/master/_resources/Firefox.png) [Mozilla Firefox](http://www.mozilla.org/en-US/firefox/fx/#desktop) desktop.
2625

2726
## Version History
2827

29-
* **0.1.1**
30-
* Doing some clean up;
31-
* Fixed info link;
32-
* **0.1.0**
33-
* Initial version;
28+
* **0.2.0**
29+
30+
* Rewrite after site changes (fixes [#103][]).
31+
32+
* **0.1.1**
3433

34+
* Doing some clean up;
35+
* Fixed info link;
36+
37+
* **0.1.0**
38+
39+
* Initial version;
3540

3641
## External links
3742

38-
* [Greasy Fork](https://greasyfork.org/en/scripts/6277-multiple-windows-live-ids)
39-
* [OpenUserJS](https://openuserjs.org/scripts/jerone/Multiple_Windows_Live_IDs)
43+
* [Greasy Fork](https://greasyfork.org/en/scripts/6277-multiple-windows-live-ids)
44+
* [OpenUserJS](https://openuserjs.org/scripts/jerone/Multiple_Windows_Live_IDs)
45+
46+
[#103]: https://github.com/jerone/UserScripts/issues/103

0 commit comments

Comments
 (0)