|
12 | 12 | // @updateURL https://github.com/jerone/UserScripts/raw/master/Multiple_Windows_Live_IDs/Multiple_Windows_Live_IDs.user.js |
13 | 13 | // @supportURL https://github.com/jerone/UserScripts/issues |
14 | 14 | // @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 |
16 | 16 | // @grant GM_getValue |
17 | 17 | // @grant GM_setValue |
18 | 18 | // @run-at document-end |
|
98 | 98 | var metroColors = ["#00AEDB", "#00B159", "#F37735", "#7C4199", "#FFC425", "#EC098C", "#D11141", "#000000"], metroColorsIndex = -1; |
99 | 99 |
|
100 | 100 | var css = |
101 | | - // hide ad; |
102 | | - "#brandModeTD { display:none; }" + |
| 101 | + // layout; |
| 102 | + "#maincontent, #accountTD { display: inline-block; }" + |
103 | 103 |
|
104 | 104 | // 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; }" + |
107 | 107 | "#accountTD .profile:hover{ opacity: 0.85; }" + |
108 | 108 | "#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; }" + |
111 | 111 | "#accountTD .profile > div { display: none; position: absolute; right: 0; top: 0; }" + |
112 | 112 | "#accountTD .profile > div img { opacity: 0.3; margin: 4px 4px 0 0; }" + |
113 | 113 | "#accountTD .profile:hover > div { display: block; }" + |
114 | 114 | "#accountTD .profile:hover > div img:hover { opacity: 1; }" + |
115 | 115 |
|
116 | 116 | // add account button; |
117 | | - "#accountTD .addAccountBtn { opacity: 0.6; width: 88px; height: 88px; }" + |
| 117 | + "#accountTD .addAccountBtn { opacity: 0.6; width: 100px; height: 100px; }" + |
118 | 118 | "#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; }" + |
121 | 121 | "#accountTD .addAccountBtn > div { float: right; }" + |
122 | 122 |
|
123 | 123 | // edit account; |
124 | | - "#editAccountTD { display: none; width: 420px; position: relative; }" + |
| 124 | + "#editAccountTD { display: none; position: relative; }" + |
125 | 125 | "#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; }" + |
129 | 128 | "#editAccountCancel { background-color: #D11141; margin-left: 8px; }" + |
130 | 129 |
|
131 | 130 | // 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; }"; |
136 | 132 | var stylesheet = document.createElement("style"); |
137 | 133 | stylesheet.type = "text/css"; |
138 | 134 | if (stylesheet.styleSheet) { |
|
144 | 140 |
|
145 | 141 | var accountTD = document.createElement("div"); |
146 | 142 | accountTD.id = "accountTD"; |
147 | | - accountTD.classList.add("floatLeft"); |
148 | 143 |
|
149 | | - var mainTD = document.getElementById("mainTD"); |
150 | | - mainTD.insertBefore(accountTD, mainTD.firstChild); |
| 144 | + var mainTD = document.getElementById("maincontent"); |
| 145 | + mainTD.parentNode.insertBefore(accountTD, mainTD); |
151 | 146 |
|
152 | 147 | function paint() { |
153 | 148 | profiles.forEach(function(profile, i) { |
|
163 | 158 | profileDiv.style.backgroundColor = profile.color; |
164 | 159 | profileDiv.addEventListener("click", proxy(function(_event, _profile) { |
165 | 160 | document.getElementById("i0116").value = _profile.mail; |
| 161 | + fireEvent(document.getElementById("i0116"), "change"); |
166 | 162 |
|
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"); |
174 | 165 |
|
175 | 166 | if (autoLogin) { |
176 | 167 | document.getElementById("idSIButton9").click(); |
|
239 | 230 | profileManageEdit.addEventListener("click", proxy(function(_event, _profile, _i) { |
240 | 231 | _event.stopPropagation(); |
241 | 232 |
|
242 | | - document.getElementById("signInTD").style.display = "none"; |
| 233 | + document.querySelector("#maincontent > section").style.display = "none"; |
243 | 234 |
|
244 | 235 | document.getElementById("editAccountTD").style.display = "block"; |
245 | 236 |
|
|
275 | 266 | addAccountBtnDiv.setAttribute("title", "Add account"); |
276 | 267 | addAccountBtnDiv.style.backgroundColor = "#0072C6"; |
277 | 268 | addAccountBtnDiv.addEventListener("click", function() { |
278 | | - document.getElementById("signInTD").style.display = "none"; |
| 269 | + document.querySelector("#maincontent > section").style.display = "none"; |
279 | 270 |
|
280 | 271 | document.getElementById("editAccountTD").style.display = "block"; |
281 | 272 |
|
|
311 | 302 | '<div id="i0272" class="signInHeader" style="height: 80px;">' + |
312 | 303 | '<h1><img src="' + image.header + '" alt="Multiple Windows Live IDs" /></h1>' + |
313 | 304 | '</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>' + |
326 | 322 | '</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>' + |
329 | 325 | '</div>'; |
330 | 326 | mainTD.appendChild(editAccountDiv); |
331 | 327 |
|
|
350 | 346 |
|
351 | 347 | if (addPassMask) { addPassMaskFn(editAccountPass); } |
352 | 348 |
|
353 | | - document.getElementById("editAccountSubmit").addEventListener("click", function() { |
| 349 | + document.getElementById("editAccountSubmit").addEventListener("click", function(e) { |
| 350 | + e.preventDefault(); |
| 351 | + |
354 | 352 | editAccountMailError.style.display = !editAccountMail.value ? "block" : "none"; |
355 | 353 | editAccountPassError.style.display = !editAccountPass.value ? "block" : "none"; |
356 | 354 |
|
|
369 | 367 |
|
370 | 368 | repaint(); |
371 | 369 |
|
372 | | - document.getElementById("signInTD").style.display = "block"; |
| 370 | + document.querySelector("#maincontent > section").style.display = "block"; |
373 | 371 |
|
374 | 372 | document.getElementById("editAccountTD").style.display = "none"; |
375 | 373 |
|
376 | 374 | setAccount(); |
377 | 375 | }); |
378 | 376 |
|
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"; |
381 | 381 |
|
382 | 382 | document.getElementById("editAccountTD").style.display = "none"; |
383 | 383 |
|
|
390 | 390 | editAccountHeader1.style.display = !id ? "block" : "none"; |
391 | 391 | editAccountHeader2.style.display = id ? "block" : "none"; |
392 | 392 |
|
393 | | - editAccountId.value = id || -1; |
| 393 | + editAccountId.value = id != null ? id : -1; |
394 | 394 | editAccountName.value = profile.name || ""; |
395 | 395 | editAccountMail.value = profile.mail || ""; |
396 | 396 | editAccountPass.value = profile.pass || ""; |
|
0 commit comments