Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Keeping up with Quora UI changes.

  • Loading branch information...
commit 2b79a403dadf342973319f98151c3fac5261b0c5 1 parent 7c34113
Bulat Bochkariov authored
Showing with 5 additions and 8 deletions.
  1. +4 −7 bookmarklet.js
  2. +1 −1  bookmarklet.min.js
11 bookmarklet.js
View
@@ -46,7 +46,7 @@
},
inputField: {
background: '#f9f9f9',
- border: '1px solid #ccc',
+ border: '1px solid #bbb',
display: 'block',
padding: '2px'
},
@@ -84,7 +84,7 @@
'float': 'left',
margin: '-1px 10px 0 0',
'min-width': '0',
- padding: '2px 10px'
+ padding: '1px 8px'
},
cancelButton: {
'font-size': '0.97em',
@@ -314,15 +314,12 @@
* If you like benchmarks, you might want to see this:
*
* http://jsperf.com/mention-editor-html-templating
- *
- * Turns out the oft-touted .split().join() is relatively butt-slow. And
- * yeah, this could be twice as fast if I used %ns% everywhere.
*/
function tooltipHtml(namespace) {
return (
'<div class="hover_menu">' +
'<div id="arrowNub" class="hover_menu_nub"></div>' +
- '<div id="prompt" class="menu_contents growl_notification">' +
+ '<div id="prompt" class="hover_menu_contents">' +
'<input id="inputField" type="text" />' +
'<div id="controls">' +
'<a id="okButton" href="#" class="submit_button">Save</a>' +
@@ -421,7 +418,7 @@
/* Now let's get down to business (to defeat the DOM). */
- okButton = tooltip.find('.menu_contents').find('a').first();
+ okButton = tooltip.find('.hover_menu_contents').find('a').first();
cancelButton = okButton.next();
editorCancelButton = target.closest('.inline_editor_form').find('.inline_editor_cancel_button');
helpToggle = tooltip.find(id('helpToggle'));
2  bookmarklet.min.js
View
@@ -1 +1 @@
-javascript:(function(){var%20j%3D%221.1%22%2Cc%3D%22http%3A//bochkariov.com/quora/edit-mentions/update%3Fversion%3D%22+j%2Cg%3D%22http%3A//bochkariov.com/quora/edit-mentions/bugs%3Fversion%3D%22+j%2Cl%3D%7BarrowNub%3A%7B%22background-position%22%3A%2210px%20top%22%7D%2Cprompt%3A%7Bbackground%3A%22%23fdfdfd%22%2Cpadding%3A%2211px%22%2Cwidth%3A%22auto%22%7D%2CinputField%3A%7Bbackground%3A%22%23f9f9f9%22%2Cborder%3A%221px%20solid%20%23ccc%22%2Cdisplay%3A%22block%22%2Cpadding%3A%222px%22%7D%2Ccontrols%3A%7Bmargin%3A%222px%200%200%200%22%2Coverflow%3A%22auto%22%2Cpadding%3A%226px%204px%200%200%22%7D%2C%22controls%20a%3Alast-child%22%3A%7Bcolor%3A%22%23777%22%2C%22float%22%3A%22right%22%7D%2C%22controls%3Ahover%20a%3Alast-child%22%3A%7Bdisplay%3A%22inline%22%2C%7D%2C%22controls%3Ahover%20a%3Alast-child%3Ahover%22%3A%7Bcolor%3A%22%2319558D%22%2C%22text-decoration%22%3A%22none%22%7D%2C%22controls%20a%3Afocus%22%3A%7Bborder%3A%220%22%2Coutline%3A%22none%22%7D%2Chelp%3A%7Bdisplay%3A%22none%22%2Cmargin%3A%220%22%2Cpadding%3A%226px%204px%200%200%22%7D%2C%22help%20a%22%3A%7Bcolor%3A%22%23777%22%2C%22font-size%22%3A%220.97em%22%2C%7D%2CokButton%3A%7Bdisplay%3A%22block%22%2C%22float%22%3A%22left%22%2Cmargin%3A%22-1px%2010px%200%200%22%2C%22min-width%22%3A%220%22%2Cpadding%3A%222px%2010px%22%7D%2CcancelButton%3A%7B%22font-size%22%3A%220.97em%22%2C%22text-decoration%22%3A%22underline%22%7D%2C%22.hidden%22%3A%7Bdisplay%3A%22none%22%7D%7D%2Ck%3Ddocument.getSelection%28%29.focusNode%2Ci%3Df%28k%29%2Cd%3Di.text%28%29%3Bif%28i.length%21%3D%3D0%29%7Be%28i%2Cfunction%28m%2Cn%29%7Bm.text%28n%29%7D%2Cfunction%28m%29%7Bm.text%28d%29%7D%2Cfunction%28m%2Cn%29%7Bm.text%28n%29%7D%29%7Dfunction%20h%28q%2Cp%29%7Bvar%20o%3D%22%22%2Cn%3Bfor%28var%20m%20in%20q%29%7Bif%28q.hasOwnProperty%28m%29%29%7Bn%3Dq%5Bm%5D%3Bif%28m.charAt%280%29%3D%3D%3D%22.%22%29%7Bo+%3Dm.replace%28%22.%22%2C%22.%22+p%29+%22%7B%22%7Delse%7Bo+%3D%22%23%22+p+m+%22%7B%22%7Dfor%28var%20r%20in%20n%29%7Bif%28n.hasOwnProperty%28r%29%29%7Bo+%3Dr+%22%3A%22+n%5Br%5D+%22%3B%22%7D%7Do+%3D%22%7D%22%7D%7Dreturn%20o%7Dfunction%20b%28n%29%7Bvar%20o%2Cm%3Ddocument.createRange%28%29%2Cp%3Ddocument.createTextNode%28%22%22%29%3Bn.closest%28%22.qtext_editor_content%22%29.focus%28%29%3Bo%3Dwindow.getSelection%28%29%3Bif%28o.rangeCount%3E0%29%7Bo.removeAllRanges%28%29%7D%24%28p%29.insertAfter%28n%29%3Bm.selectNodeContents%28p%29%3Bm.collapse%28true%29%3Bo.addRange%28m%29%7Dfunction%20f%28q%29%7Bfunction%20p%28%29%7Bvar%20t%3Dm.endOffset%3D%3D%3Dm.endContainer.length%2Cs%3D%24%28m.endContainer.nextSibling%29.is%28%22a%22%29%3Breturn%20t%26%26s%7Dfunction%20o%28%29%7Bvar%20t%3Dm.startOffset%3D%3D%3D0%2Cs%3D%24%28m.startContainer.previousSibling%29.is%28%22a%22%29%3Breturn%20t%26%26s%7Dvar%20n%3D%24%28q%29%2Cr%3Dn.closest%28%22a%22%29%2Cm%3Dwindow.getSelection%28%29.getRangeAt%280%29%3Bif%28q.nodeType%3D%3D%3D3%29%7Bif%28r.length%3D%3D%3D0%29%7Bif%28p%28%29%29%7Breturn%20f%28m.endContainer.nextSibling%29%7Delse%7Bif%28o%28%29%29%7Breturn%20f%28m.startContainer.previousSibling%29%7Delse%7Breturn%20new%20jQuery.fn.init%28%29%7D%7D%7Delse%7Breturn%20r%7D%7Delse%7Bif%28n.is%28%22a%22%29%29%7Breturn%20n%7Delse%7Breturn%20new%20jQuery.fn.init%28%29%7D%7D%7Dfunction%20a%28m%29%7Breturn%28%27%3Cdiv%20class%3D%22hover_menu%22%3E%3Cdiv%20id%3D%22arrowNub%22%20class%3D%22hover_menu_nub%22%3E%3C/div%3E%3Cdiv%20id%3D%22prompt%22%20class%3D%22menu_contents%20growl_notification%22%3E%3Cinput%20id%3D%22inputField%22%20type%3D%22text%22%20/%3E%3Cdiv%20id%3D%22controls%22%3E%3Ca%20id%3D%22okButton%22%20href%3D%22%23%22%20class%3D%22submit_button%22%3ESave%3C/a%3E%3Ca%20id%3D%22cancelButton%22%20href%3D%22%23%22%20title%3D%22Undo%20changes%20and%20close%22%3ECancel%3C/a%3E%3Ca%20id%3D%22helpToggle%22%20class%3D%22%25ns%25hidden%22%20href%3D%22%23%22%3E+%3C/a%3E%3C/div%3E%3Cdiv%20id%3D%22help%22%3E%3Ca%20href%3D%22%27+c+%27%22%20title%3D%22You%20have%20version%20%27+j+%27%22%20target%3D%22_%25ns%25_update%22%3ECheck%20for%20updates%3C/a%3E%3Cbr/%3E%3Ca%20href%3D%22%27+g+%27%22%20target%3D%22_%25ns%25_issues%22%3EReport%20bug%3C/a%3E%3C/div%3E%3C/div%3E%3C/div%3E%27%29.replace%28/id%3D%22/g%2C%27id%3D%22%27+m%29.replace%28/%25ns%25/g%2Cm%29%7Dfunction%20e%28t%2Cx%2Cw%2Cz%29%7Bfunction%20n%28A%29%7Breturn%22%23%22+r+A%7Dfunction%20m%28%29%7Bvar%20A%3Dt.offset%28%29%3By.css%28%7Bposition%3A%22absolute%22%2Ctop%3AA.top+t.outerHeight%28%29+2%2Cleft%3AA.left%7D%29%7Dfunction%20q%28%29%7By.fadeOut%28%22fast%22%2Cfunction%28%29%7By.remove%28%29%3B%24%28n%28%22style%22%29%29.remove%28%29%3Bt.css%28%7Bbackground%3A%22%23fff%22%7D%29%3Bb%28t%29%7D%29%3Bu.unbind%28%22.%22+r%29%3Bt.closest%28%22.qtext_editor_content%22%29.unbind%28%22.%22+r%29%7Dvar%20r%3D%22qp_%22+%28+new%20Date%28%29%29+%22__%22%2Cy%3D%24%28a%28r%29%29%2Cp%3Dy.find%28%22input%22%29%2Cv%2Co%2Cu%2Cs%3B%24%28%22head%22%29.append%28%24%28%27%3Cstyle%20type%3D%22text/css%22%3E%27+h%28l%2Cr%29+%22%3C/style%3E%22%2C%7Bid%3Ar+%22style%22%7D%29%29%3Bt.css%28%7Bbackground%3A%22%23ffff80%22%7D%29%3Bm%28%29%3By.appendTo%28%22body%22%29%3Bp.val%28t.text%28%29%29.select%28%29%3Bv%3Dy.find%28%22.menu_contents%22%29.find%28%22a%22%29.first%28%29%3Bo%3Dv.next%28%29%3Bu%3Dt.closest%28%22.inline_editor_form%22%29.find%28%22.inline_editor_cancel_button%22%29%3Bs%3Dy.find%28n%28%22helpToggle%22%29%29%3Bp.keyup%28function%28A%29%7Bif%28A.which%3D%3D%3D13%29%7Bx%28t%2Cp.val%28%29%29%3Bq%28%29%7Delse%7Bif%28A.which%3D%3D%3D27%29%7Bw%28t%2Cp.val%28%29%29%3Bq%28%29%7Delse%7Btypeof%20z%3D%3D%3D%22function%22%26%26z%28t%2Cp.val%28%29%29%7D%7D%7D%29%3Bv.click%28function%28%29%7Bx%28t%2Cp.val%28%29%29%3Bq%28%29%3Breturn%20false%7D%29%3Bo.click%28function%28%29%7Bw%28t%29%3Bq%28%29%3Breturn%20false%7D%29%3Bu.bind%28%22click.%22+r%2Cfunction%28%29%7Bw%28t%29%3Bq%28%29%7D%29%3Bt.closest%28%22.qtext_editor_content%22%29.bind%28%22keyup.%22+r%2Cm%29.bind%28%22keydown.%22+r%2Cfunction%28%29%7Bvar%20A%3Ddocument.getSelection%28%29.focusNode%2CB%3Dt.length%21%3D%3D0%3Bif%28B%26%26f%28A%29.get%280%29%3D%3D%3Dt.get%280%29%29%7Breturn%20false%7D%7D%29%3Bs.toggle%28function%28%29%7B%24%28n%28%22help%22%29%29.slideDown%28%22fast%22%29%3B%24%28this%29.text%28%22%5Cu00d7%22%29.removeClass%28r+%22hidden%22%29%3Breturn%20false%7D%2Cfunction%28%29%7B%24%28n%28%22help%22%29%29.slideUp%28%22fast%22%29%3B%24%28this%29.text%28%22+%22%29.addClass%28r+%22hidden%22%29%3Breturn%20false%7D%29%3Breturn%20y%7D})();
+javascript:(function(){var%20j=%221.1%22,c=%22http://bochkariov.com/quora/edit-mentions/update%3Fversion=%22+j,g=%22http://bochkariov.com/quora/edit-mentions/bugs%3Fversion=%22+j,l={arrowNub:{%22background-position%22:%2210px%20top%22},prompt:{background:%22%23fdfdfd%22,padding:%2211px%22,width:%22auto%22},inputField:{background:%22%23f9f9f9%22,border:%221px%20solid%20%23bbb%22,display:%22block%22,padding:%222px%22},controls:{margin:%222px%200%200%200%22,overflow:%22auto%22,padding:%226px%204px%200%200%22},%22controls%20a:last-child%22:{color:%22%23777%22,%22float%22:%22right%22},%22controls:hover%20a:last-child%22:{display:%22inline%22,},%22controls:hover%20a:last-child:hover%22:{color:%22%2319558D%22,%22text-decoration%22:%22none%22},%22controls%20a:focus%22:{border:%220%22,outline:%22none%22},help:{display:%22none%22,margin:%220%22,padding:%226px%204px%200%200%22},%22help%20a%22:{color:%22%23777%22,%22font-size%22:%220.97em%22,},okButton:{display:%22block%22,%22float%22:%22left%22,margin:%22-1px%2010px%200%200%22,%22min-width%22:%220%22,padding:%221px%208px%22},cancelButton:{%22font-size%22:%220.97em%22,%22text-decoration%22:%22underline%22},%22.hidden%22:{display:%22none%22}},k=document.getSelection().focusNode,i=f(k),d=i.text();if(i.length!==0){e(i,function(m,n){m.text(n)},function(m){m.text(d)},function(m,n){m.text(n)})}function%20h(q,p){var%20o=%22%22,n;for(var%20m%20in%20q){if(q.hasOwnProperty(m)){n=q[m];if(m.charAt(0)===%22.%22){o+=m.replace(%22.%22,%22.%22+p)+%22{%22}else{o+=%22%23%22+p+m+%22{%22}for(var%20r%20in%20n){if(n.hasOwnProperty(r)){o+=r+%22:%22+n[r]+%22;%22}}o+=%22}%22}}return%20o}function%20b(n){var%20o,m=document.createRange(),p=document.createTextNode(%22%22);n.closest(%22.qtext_editor_content%22).focus();o=window.getSelection();if(o.rangeCount%3E0){o.removeAllRanges()}$(p).insertAfter(n);m.selectNodeContents(p);m.collapse(true);o.addRange(m)}function%20f(q){function%20p(){var%20t=m.endOffset===m.endContainer.length,s=$(m.endContainer.nextSibling).is(%22a%22);return%20t%26%26s}function%20o(){var%20t=m.startOffset===0,s=$(m.startContainer.previousSibling).is(%22a%22);return%20t%26%26s}var%20n=$(q),r=n.closest(%22a%22),m=window.getSelection().getRangeAt(0);if(q.nodeType===3){if(r.length===0){if(p()){return%20f(m.endContainer.nextSibling)}else{if(o()){return%20f(m.startContainer.previousSibling)}else{return%20new%20jQuery.fn.init()}}}else{return%20r}}else{if(n.is(%22a%22)){return%20n}else{return%20new%20jQuery.fn.init()}}}function%20a(m){return('%3Cdiv%20class=%22hover_menu%22%3E%3Cdiv%20id=%22arrowNub%22%20class=%22hover_menu_nub%22%3E%3C/div%3E%3Cdiv%20id=%22prompt%22%20class=%22hover_menu_contents%22%3E%3Cinput%20id=%22inputField%22%20type=%22text%22%20/%3E%3Cdiv%20id=%22controls%22%3E%3Ca%20id=%22okButton%22%20href=%22%23%22%20class=%22submit_button%22%3ESave%3C/a%3E%3Ca%20id=%22cancelButton%22%20href=%22%23%22%20title=%22Undo%20changes%20and%20close%22%3ECancel%3C/a%3E%3Ca%20id=%22helpToggle%22%20class=%22%25ns%25hidden%22%20href=%22%23%22%3E+%3C/a%3E%3C/div%3E%3Cdiv%20id=%22help%22%3E%3Ca%20href=%22'+c+'%22%20title=%22You%20have%20version%20'+j+'%22%20target=%22_%25ns%25_update%22%3ECheck%20for%20updates%3C/a%3E%3Cbr/%3E%3Ca%20href=%22'+g+'%22%20target=%22_%25ns%25_issues%22%3EReport%20bug%3C/a%3E%3C/div%3E%3C/div%3E%3C/div%3E').replace(/id=%22/g,'id=%22'+m).replace(/%25ns%25/g,m)}function%20e(t,x,w,z){function%20n(A){return%22%23%22+r+A}function%20m(){var%20A=t.offset();y.css({position:%22absolute%22,top:A.top+t.outerHeight()+2,left:A.left})}function%20q(){y.fadeOut(%22fast%22,function(){y.remove();$(n(%22style%22)).remove();t.css({background:%22%23fff%22});b(t)});u.unbind(%22.%22+r);t.closest(%22.qtext_editor_content%22).unbind(%22.%22+r)}var%20r=%22qp_%22+(+new%20Date())+%22__%22,y=$(a(r)),p=y.find(%22input%22),v,o,u,s;$(%22head%22).append($('%3Cstyle%20type=%22text/css%22%3E'+h(l,r)+%22%3C/style%3E%22,{id:r+%22style%22}));t.css({background:%22%23ffff80%22});m();y.appendTo(%22body%22);p.val(t.text()).select();v=y.find(%22.hover_menu_contents%22).find(%22a%22).first();o=v.next();u=t.closest(%22.inline_editor_form%22).find(%22.inline_editor_cancel_button%22);s=y.find(n(%22helpToggle%22));p.keyup(function(A){if(A.which===13){x(t,p.val());q()}else{if(A.which===27){w(t,p.val());q()}else{typeof%20z===%22function%22%26%26z(t,p.val())}}});v.click(function(){x(t,p.val());q();return%20false});o.click(function(){w(t);q();return%20false});u.bind(%22click.%22+r,function(){w(t);q()});t.closest(%22.qtext_editor_content%22).bind(%22keyup.%22+r,m).bind(%22keydown.%22+r,function(){var%20A=document.getSelection().focusNode,B=t.length!==0;if(B%26%26f(A).get(0)===t.get(0)){return%20false}});s.toggle(function(){$(n(%22help%22)).slideDown(%22fast%22);$(this).text(%22\u00d7%22).removeClass(r+%22hidden%22);return%20false},function(){$(n(%22help%22)).slideUp(%22fast%22);$(this).text(%22+%22).addClass(r+%22hidden%22);return%20false});return%20y}})();
Please sign in to comment.
Something went wrong with that request. Please try again.