Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

1.8.1 Update

  • Loading branch information...
commit c2bb5f8a77a5f23bf633efacdf45d7ca02499413 2 parents 245d782 + 5110da9
SkyArrow authored July 04, 2012

Showing 1 changed file with 41 additions and 46 deletions. Show diff stats Hide diff stats

  1. 87  google_hover_zoom.user.js
87  google_hover_zoom.user.js
@@ -5,7 +5,7 @@
5 5
 // @author         SkyArrow
6 6
 // @website        http://userscripts.org/scripts/show/106681
7 7
 // @namespace      http://zespia.tw
8  
-// @version        1.8
  8
+// @version        1.8.1
9 9
 // @license        MIT License
10 10
 // @include        https://plus.google.com/*
11 11
 // @exclude        https://plus.google.com/ripples/*
@@ -27,7 +27,7 @@ a){var b=F.exec(a);b&&(b[1]=(b[1]||"").toLowerCase(),b[3]=b[3]&&new RegExp("(?:^
27 27
  */
28 28
 (function(a,b,c){"use strict";var d=b.event,e;d.special.smartresize={setup:function(){b(this).bind("resize",d.special.smartresize.handler)},teardown:function(){b(this).unbind("resize",d.special.smartresize.handler)},handler:function(a,c){var d=this,f=arguments;a.type="smartresize",e&&clearTimeout(e),e=setTimeout(function(){b.event.handle.apply(d,f)},c==="execAsap"?0:100)}},b.fn.smartresize=function(a){return a?this.bind("smartresize",a):this.trigger("smartresize",["execAsap"])},b.Mason=function(a,c){this.element=b(c),this._create(a),this._init()},b.Mason.settings={isResizable:!0,isAnimated:!1,animationOptions:{queue:!1,duration:500},gutterWidth:0,isRTL:!1,isFitWidth:!1,containerStyle:{position:"relative"}},b.Mason.prototype={_filterFindBricks:function(a){var b=this.options.itemSelector;return b?a.filter(b).add(a.find(b)):a},_getBricks:function(a){var b=this._filterFindBricks(a).css({position:"absolute"}).addClass("masonry-brick");return b},_create:function(c){this.options=b.extend(!0,{},b.Mason.settings,c),this.styleQueue=[];var d=this.element[0].style;this.originalStyle={height:d.height||""};var e=this.options.containerStyle;for(var f in e)this.originalStyle[f]=d[f]||"";this.element.css(e),this.horizontalDirection=this.options.isRTL?"right":"left",this.offset={x:parseInt(this.element.css("padding-"+this.horizontalDirection),10),y:parseInt(this.element.css("padding-top"),10)},this.isFluid=this.options.columnWidth&&typeof this.options.columnWidth=="function";var g=this;setTimeout(function(){g.element.addClass("masonry")},0),this.options.isResizable&&b(a).bind("smartresize.masonry",function(){g.resize()}),this.reloadItems()},_init:function(a){this._getColumns(),this._reLayout(a)},option:function(a,c){b.isPlainObject(a)&&(this.options=b.extend(!0,this.options,a))},layout:function(a,b){for(var c=0,d=a.length;c<d;c++)this._placeBrick(a[c]);var e={};e.height=Math.max.apply(Math,this.colYs);if(this.options.isFitWidth){var f=0;c=this.cols;while(--c){if(this.colYs[c]!==0)break;f++}e.width=(this.cols-f)*this.columnWidth-this.options.gutterWidth}this.styleQueue.push({$el:this.element,style:e});var g=this.isLaidOut?this.options.isAnimated?"animate":"css":"css",h=this.options.animationOptions,i;for(c=0,d=this.styleQueue.length;c<d;c++)i=this.styleQueue[c],i.$el[g](i.style,h);this.styleQueue=[],b&&b.call(a),this.isLaidOut=!0},_getColumns:function(){var a=this.options.isFitWidth?this.element.parent():this.element,b=a.width();this.columnWidth=this.isFluid?this.options.columnWidth(b):this.options.columnWidth||this.$bricks.outerWidth(!0)||b,this.columnWidth+=this.options.gutterWidth,this.cols=Math.floor((b+this.options.gutterWidth)/this.columnWidth),this.cols=Math.max(this.cols,1)},_placeBrick:function(a){var c=b(a),d,e,f,g,h;d=Math.ceil(c.outerWidth(!0)/this.columnWidth),d=Math.min(d,this.cols);if(d===1)f=this.colYs;else{e=this.cols+1-d,f=[];for(h=0;h<e;h++)g=this.colYs.slice(h,h+d),f[h]=Math.max.apply(Math,g)}var i=Math.min.apply(Math,f),j=0;for(var k=0,l=f.length;k<l;k++)if(f[k]===i){j=k;break}var m={top:i+this.offset.y};m[this.horizontalDirection]=this.columnWidth*j+this.offset.x,this.styleQueue.push({$el:c,style:m});var n=i+c.outerHeight(!0),o=this.cols+1-l;for(k=0;k<o;k++)this.colYs[j+k]=n},resize:function(){var a=this.cols;this._getColumns(),(this.isFluid||this.cols!==a)&&this._reLayout()},_reLayout:function(a){var b=this.cols;this.colYs=[];while(b--)this.colYs.push(0);this.layout(this.$bricks,a)},reloadItems:function(){this.$bricks=this._getBricks(this.element.children())},reload:function(a){this.reloadItems(),this._init(a)},appended:function(a,b,c){if(b){this._filterFindBricks(a).css({top:this.element.height()});var d=this;setTimeout(function(){d._appended(a,c)},1)}else this._appended(a,c)},_appended:function(a,b){var c=this._getBricks(a);this.$bricks=this.$bricks.add(c),this.layout(c,b)},remove:function(a){this.$bricks=this.$bricks.not(a),a.remove()},destroy:function(){this.$bricks.removeClass("masonry-brick").each(function(){this.style.position="",this.style.top="",this.style.left=""});var c=this.element[0].style;for(var d in this.originalStyle)c[d]=this.originalStyle[d];this.element.unbind(".masonry").removeClass("masonry").removeData("masonry"),b(a).unbind(".masonry")}},b.fn.imagesLoaded=function(a){function h(){a.call(c,d)}function i(a){var c=a.target;c.src!==f&&b.inArray(c,g)===-1&&(g.push(c),--e<=0&&(setTimeout(h),d.unbind(".imagesLoaded",i)))}var c=this,d=c.find("img").add(c.filter("img")),e=d.length,f="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///ywAAAAAAQABAAACAUwAOw==",g=[];return e||h(),d.bind("load.imagesLoaded error.imagesLoaded",i).each(function(){var a=this.src;this.src=f,this.src=a}),c};var f=function(b){a.console&&a.console.error(b)};b.fn.masonry=function(a){if(typeof a=="string"){var c=Array.prototype.slice.call(arguments,1);this.each(function(){var d=b.data(this,"masonry");if(!d){f("cannot call methods on masonry prior to initialization; attempted to call method '"+a+"'");return}if(!b.isFunction(d[a])||a.charAt(0)==="_"){f("no such method '"+a+"' for masonry instance");return}d[a].apply(d,c)})}else this.each(function(){var c=b.data(this,"masonry");c?(c.option(a||{}),c._init()):b.data(this,"masonry",new b.Mason(a,this))});return this}})(window,jQuery);
29 29
 
30  
-var version = '1.8',
  30
+var version = '1.8.1',
31 31
 	developer = false,
32 32
 	picRegex = /.(jpg|jpeg|gif|bmp|png|tiff)/i,
33 33
 	picasaRegex = /\/\w\d+(-\w\d*)*\/([^\/]+)$/,
@@ -35,11 +35,6 @@ var version = '1.8',
35 35
 	mouse = [],
36 36
 	$content = $('#content');
37 37
 
38  
-// Selectors
39  
-var selectors = ['.Om', '.cF', '.Bo', '.ot-anchor', '.Gn', '.vja', '.Ag', '.Si', '.uc', '.gu',
40  
-	'.Gm', '.Mi', '.oh', '.aw', '.Uga', '.cn', '.bZ', '.cA', '.lp', '.Gb',
41  
-	'.UN', '.kA'];
42  
-
43 38
 // Options
44 39
 var options = {
45 40
 	hz_delay: parseInt(localStorage.hz_delay) || 500,
@@ -856,9 +851,9 @@ var init = {
856 851
 		menu(elements.menu.setting);
857 852
 		if (options.hz_his === 'true') menu(elements.menu.history);
858 853
 		if (options.hz_allpics === 'true') menu(elements.menu.allPic);
859  
-		$content.on('click', selectors[16], function(){
  854
+		$content.on('click', '.Pp', function(){
860 855
 			if (!$(this).data('class')){
861  
-				$(selectors[17]).append('<div id="hz_opts"><strong>Google+ Hover Zoom</strong><ul><li id="disable_hz">'+lang.menu02+'</li>'+menuTmp+'</ul></div>');
  856
+				$('.a-q-pd').append('<div id="hz_opts"><strong>Google+ Hover Zoom</strong><ul><li id="disable_hz">'+lang.menu02+'</li>'+menuTmp+'</ul></div>');
862 857
 				$(this).data('class', true);
863 858
 			}
864 859
 		});
@@ -951,7 +946,7 @@ var hoverzoom = function(){
951 946
 		};
952 947
 
953 948
 		var fullscreen = function(){
954  
-			var arr = $(_this).parentsUntil(selectors[21]).find(selectors[1]),
  949
+			var arr = $(_this).parentsUntil('.Ry').find('.aG'),
955 950
 				links = [];
956 951
 
957 952
 			if (arr.length > 0){
@@ -1039,9 +1034,9 @@ var hoverzoom = function(){
1039 1034
 
1040 1035
 // Enable functions
1041 1036
 var enable = function(){
1042  
-	if (options.hz_enable_main === 'true') $content.on('mouseenter', selectors[15]+' img', hoverzoom);
1043  
-	if (options.hz_enable_icon === 'true') $('body').on('mouseenter', selectors[2], hoverzoom);
1044  
-	if (options.hz_enable_link === 'true') $content.on('mouseenter', selectors[3], hoverzoom);
  1037
+	if (options.hz_enable_main === 'true') $content.on('mouseenter', '.Mn img', hoverzoom);
  1038
+	if (options.hz_enable_icon === 'true') $('body').on('mouseenter', '.Ut', hoverzoom);
  1039
+	if (options.hz_enable_link === 'true') $content.on('mouseenter', '.ot-anchor', hoverzoom);
1045 1040
 
1046 1041
 	$('#hoverzoom_db').addClass('enable');
1047 1042
 	if (options.hz_ecomode === 'true'){
@@ -1053,9 +1048,9 @@ var enable = function(){
1053 1048
 
1054 1049
 // Disable functions
1055 1050
 var disable = function(){
1056  
-	if (options.hz_enable_main === 'true') $content.off('mouseenter', selectors[15]+' img', hoverzoom);
1057  
-	if (options.hz_enable_icon === 'true') $('body').off('mouseenter', selectors[2], hoverzoom);
1058  
-	if (options.hz_enable_link === 'true') $content.off('mouseenter', selectors[3], hoverzoom);
  1051
+	if (options.hz_enable_main === 'true') $content.off('mouseenter', '.Mn img', hoverzoom);
  1052
+	if (options.hz_enable_icon === 'true') $('body').off('mouseenter', '.Ut', hoverzoom);
  1053
+	if (options.hz_enable_link === 'true') $content.off('mouseenter', '.ot-anchor', hoverzoom);
1059 1054
 
1060 1055
 	$('#hoverzoom_db').removeClass('enable');
1061 1056
 	if (options.hz_ecomode === 'true'){
@@ -1445,7 +1440,7 @@ var batch = function(){
1445 1440
 	var width = parseInt(($(window).width() - 200) / options.hz_his_columns - 10),
1446 1441
 		arr = [];
1447 1442
 
1448  
-	$(selectors[1]+','+selectors[3]).filter(':visible').each(function(){
  1443
+	$('.aG, .ot-anchor').filter(':visible').each(function(){
1449 1444
 		var tag = this.tagName.toUpperCase();
1450 1445
 		if (tag == 'IMG'){
1451 1446
 			var url = this.src,
@@ -1546,7 +1541,7 @@ var ytDL = function(url, ele){
1546 1541
 						}
1547 1542
 					}
1548 1543
 
1549  
-					ele.addClass('loaded').append(appends).parentsUntil(selectors[13]).next().find(selectors[4]).css('position', 'static');
  1544
+					ele.addClass('loaded').append(appends).parentsUntil('.ow').next().find('.ii').css('position', 'static');
1550 1545
 				} else {
1551 1546
 					$notify.html(lang.ytdl08);
1552 1547
 				}
@@ -1584,20 +1579,20 @@ var process = {
1584 1579
 		var url = obj.href;
1585 1580
 		if (url.match(/\/photos\/\w+\/albums\/\w+/)){
1586 1581
 			var button = $('<div class="hz_albumDownload hz_dlButton" aria-label="'+lang.al01+'" data-tooltip="'+lang.al01+'" role="button"><span></span></div>').data('url', url);
1587  
-			$(obj).parentsUntil(selectors[4]).next().children().eq(-1).before(button);
  1582
+			$(obj).parentsUntil('.ii').next().children().eq(-1).before(button);
1588 1583
 		}
1589 1584
 	},
1590 1585
 	// Append album download button to album page
1591 1586
 	album_page: function(obj, url){
1592 1587
 		var button = $('<div class="hz_in-albumDownload hz_button blue" role="button">'+lang.fs03+'</div>').data('url', url);
1593  
-		obj.data('class', true).next().find(selectors[5]).children().eq(1).before(button);
  1588
+		obj.data('class', true).next().find('.Rqa').children().eq(1).before(button);
1594 1589
 	},
1595 1590
 	// Process links in posts
1596 1591
 	post: function(obj){
1597 1592
 		var url = obj.href;
1598 1593
 
1599 1594
 		if (url.match(picRegex)){
1600  
-			var auto = $(obj).parentsUntil(selectors[10]).next().find(selectors[3]).attr('href');
  1595
+			var auto = $(obj).parentsUntil('.ci').next().find('.ot-anchor').attr('href');
1601 1596
 
1602 1597
 			if (url != auto){
1603 1598
 				var width = $(obj).parent().width();
@@ -1607,12 +1602,12 @@ var process = {
1607 1602
 	},
1608 1603
 	// Process Youtube video in posts
1609 1604
 	tube: function(obj){
1610  
-		var button = $('<div class="hz_tubeStacks hz_dlButton" aria-label="'+lang.ytdl01+'" data-tooltip="'+lang.ytdl01+'" role="button"><span></span></div>').data('url', $(obj).find(selectors[3]).attr('href'));
1611  
-		$(obj).parentsUntil(selectors[4]).next().children().eq(-1).before(button);
  1605
+		var button = $('<div class="hz_tubeStacks hz_dlButton" aria-label="'+lang.ytdl01+'" data-tooltip="'+lang.ytdl01+'" role="button"><span></span></div>').data('url', $(obj).find('.ot-anchor').attr('href'));
  1606
+		$(obj).parentsUntil('.ii').next().children().eq(-1).before(button);
1612 1607
 	},
1613 1608
 	// Display download links below pictures
1614 1609
 	links: function(obj){
1615  
-		var target = $(obj).find(selectors[15]+' '+selectors[1]+', .hz_img-in-post img'),
  1610
+		var target = $(obj).find('.aG, .hz_img-in-post img'),
1616 1611
 			length = target.length;
1617 1612
 
1618 1613
 		if (length > 1){
@@ -1654,7 +1649,7 @@ var process = {
1654 1649
 							});
1655 1650
 						}
1656 1651
 
1657  
-						$(this).after(popup).next().fadeIn(300).offset({left: $(this).offset().left - 13, top: $(this).offset().top + 31}).parentsUntil(selectors[13]).next().find(selectors[4]).css('position', 'static');
  1652
+						$(this).after(popup).next().fadeIn(300).offset({left: $(this).offset().left - 13, top: $(this).offset().top + 31}).parentsUntil('.ow').next().find('.ii').css('position', 'static');
1658 1653
 					} else {
1659 1654
 						if ($(this).next().is(':hidden')){
1660 1655
 							$(this).next().fadeIn(300).offset({left: $(this).offset().left - 13, top: $(this).offset().top + 31});
@@ -1677,7 +1672,7 @@ var process = {
1677 1672
 	},
1678 1673
 	// Resize photos in normal post to stream width
1679 1674
 	maxPic_normal: function(obj){
1680  
-		var target = $(obj).children(selectors[6]),
  1675
+		var target = $(obj).children('.Yj'),
1681 1676
 			length = target.length,
1682 1677
 			parentWidth = $(obj).width(),
1683 1678
 			original = [],
@@ -1707,7 +1702,7 @@ var process = {
1707 1702
 			$(this).addClass('hz_maxPic_container');
1708 1703
 		});
1709 1704
 
1710  
-		$(obj).parentsUntil(selectors[4]).next().children().eq(-1).before(button);
  1705
+		$(obj).parentsUntil('.ii').next().children().eq(-1).before(button);
1711 1706
 	},
1712 1707
 	// Resize photos in shared post to stream width
1713 1708
 	maxPic_shared: function(obj){
@@ -1732,7 +1727,7 @@ var process = {
1732 1727
 		modified = src;
1733 1728
 		target.src = src;
1734 1729
 		obj.removeChild(obj.childNodes[0]);
1735  
-		$(obj).parent().addClass('hz_maxPic_container').parentsUntil(selectors[4]).next().children().eq(-1).before(button);
  1730
+		$(obj).parent().addClass('hz_maxPic_container').parentsUntil('.ii').next().children().eq(-1).before(button);
1736 1731
 	}
1737 1732
 };
1738 1733
 
@@ -1742,7 +1737,7 @@ var timer = new function(){
1742 1737
 
1743 1738
 	// Process links in comments
1744 1739
 	var comment = function(){
1745  
-		$(selectors[7]+' '+selectors[3]).each(P.comment);
  1740
+		$('.Mi .ot-anchor').each(P.comment);
1746 1741
 	};
1747 1742
 
1748 1743
 	// Append album download button
@@ -1750,12 +1745,12 @@ var timer = new function(){
1750 1745
 		var page = location.href.replace(/\?(.*)/, '');
1751 1746
 
1752 1747
 		if (page.match(/\/photos\/\w+\/albums\/\w+/)){
1753  
-			var $nav = $('nav:visible');
  1748
+			var $nav = $('.kI:visible');
1754 1749
 			if (!$nav.data('class')){
1755 1750
 				P.album_page($nav, page);
1756 1751
 			}
1757 1752
 		} else {
1758  
-			$(selectors[8]).each(function(){
  1753
+			$('.pc').each(function(){
1759 1754
 				if (!$(this).data('class')){
1760 1755
 					P.album_post(this);
1761 1756
 					$(this).data('class', true);
@@ -1766,7 +1761,7 @@ var timer = new function(){
1766 1761
 
1767 1762
 	// Process links in posts
1768 1763
 	var post = function(){
1769  
-		$(selectors[9]+' '+selectors[3]).each(function(){
  1764
+		$('.VC .ot-anchor').each(function(){
1770 1765
 			if (!$(this).data('class')){
1771 1766
 				P.post(this);
1772 1767
 				$(this).data('class', true);
@@ -1776,7 +1771,7 @@ var timer = new function(){
1776 1771
 
1777 1772
 	// Process Youtube video in posts
1778 1773
 	var tube = function(){
1779  
-		$(selectors[14]).each(function(){
  1774
+		$('.oi').each(function(){
1780 1775
 			if (!$(this).data('class')){
1781 1776
 				P.tube(this);
1782 1777
 				$(this).data('class', true);
@@ -1786,7 +1781,7 @@ var timer = new function(){
1786 1781
 
1787 1782
 	// Display download links below pictures
1788 1783
 	var links = function(){
1789  
-		$(selectors[10]).each(function(){
  1784
+		$('.ci').each(function(){
1790 1785
 			if (!$(this).data('class')){
1791 1786
 				P.links(this);
1792 1787
 				$(this).data('class', true);
@@ -1796,14 +1791,14 @@ var timer = new function(){
1796 1791
 
1797 1792
 	// Resize photos to stream width
1798 1793
 	var maxPic = function(){
1799  
-		$content.find(selectors[0]+selectors[11]).filter(':visible').each(function(){
  1794
+		$content.find('.dv').filter(':visible').each(function(){
1800 1795
 			if (!$(this).data('class')){
1801 1796
 				P.maxPic_normal(this);
1802 1797
 				$(this).data('class', true);
1803 1798
 			}
1804 1799
 		});
1805 1800
 
1806  
-		$content.find(selectors[15]+selectors[3]).filter(':visible').each(function(){
  1801
+		$content.find('.Mn.ot-anchor').filter(':visible').each(function(){
1807 1802
 			if (!$(this).data('class')){
1808 1803
 				P.maxPic_shared(this);
1809 1804
 				$(this).data('class', true);
@@ -1845,31 +1840,31 @@ var ecomode = new function(){
1845 1840
 	var post = function(){
1846 1841
 		if (!$(this).data('class')){
1847 1842
 			if (options.hz_album === 'true'){
1848  
-				$(this).find(selectors[8]).each(function(){
  1843
+				$(this).find('.pc').each(function(){
1849 1844
 					P.album_post(this);
1850 1845
 				});
1851 1846
 			}
1852 1847
 			if (options.hz_direct_post === 'true'){
1853  
-				$(this).find(selectors[9]+' '+selectors[3]).each(function(){
  1848
+				$(this).find('.VC .ot-anchor').each(function(){
1854 1849
 					P.post(this);
1855 1850
 				});
1856 1851
 			}
1857 1852
 			if (options.hz_ytdl === 'true'){
1858  
-				$(this).find(selectors[14]).each(function(){
  1853
+				$(this).find('.oi').each(function(){
1859 1854
 					P.tube(this);
1860 1855
 				})
1861 1856
 			}
1862 1857
 			if (options.hz_dl_link === 'true'){
1863  
-				$(this).find(selectors[10]).each(function(){
  1858
+				$(this).find('.ci').each(function(){
1864 1859
 					P.links(this);
1865 1860
 				});
1866 1861
 			}
1867 1862
 			if (options.hz_maxpic === 'true'){
1868  
-				$(this).find(selectors[0]+selectors[11]).filter(':visible').each(function(){
  1863
+				$(this).find('.dv').filter(':visible').each(function(){
1869 1864
 					P.maxPic_normal(this);
1870 1865
 				});
1871 1866
 
1872  
-				$(this).find(selectors[15]+selectors[3]).filter(':visible').each(function(){
  1867
+				$(this).find('.Mn.ot-anchor').filter(':visible').each(function(){
1873 1868
 					P.maxPic_shared(this);
1874 1869
 				});
1875 1870
 			}
@@ -1878,22 +1873,22 @@ var ecomode = new function(){
1878 1873
 	};
1879 1874
 
1880 1875
 	var comment = function(){
1881  
-		$(this).find(selectors[7]+' '+selectors[3]).each(P.comment);
  1876
+		$(this).find('.Mi .ot-anchor').each(P.comment);
1882 1877
 	};
1883 1878
 
1884 1879
 	var album = function(){
1885 1880
 		if (!$(this).data('class')){
1886  
-			P.album_page($('nav:visible'), location.href.replace(/\?(.*)/, ''));
  1881
+			P.album_page($('.kI:visible'), location.href.replace(/\?(.*)/, ''));
1887 1882
 			$(this).data('class', true);
1888 1883
 		}
1889 1884
 	};
1890 1885
 
1891 1886
 	return {
1892 1887
 		start: function(){
1893  
-			$('body').on('mouseenter', selectors[19], post).on('mouseenter', selectors[18], comment).on('mouseenter', selectors[20], album);
  1888
+			$('body').on('mouseenter', '.ii', post).on('mouseenter', '.Ho', comment).on('mouseenter', '.UW', album);
1894 1889
 		},
1895 1890
 		stop: function(){
1896  
-			$('body').off('mouseenter', selectors[19], post).off('mouseenter', selectors[18], comment).off('mouseenter', selectors[20], album);
  1891
+			$('body').off('mouseenter', '.ii', post).off('mouseenter', '.Ho', comment).off('mouseenter', '.UW', album);
1897 1892
 		}
1898 1893
 	}
1899 1894
 };

0 notes on commit c2bb5f8

Please sign in to comment.
Something went wrong with that request. Please try again.