Code Duplication    Length = 7-26 lines in 4 locations

projects/plugins/jetpack/modules/sharedaddy/sharing-sources.php 4 locations

@@ 1042-1058 (lines=17) @@
1039
		die();
1040
	}
1041
1042
	public function display_footer() {
1043
		if ( ! $this->smart ) {
1044
			$this->js_dialog( $this->shortname, array( 'width' => 580, 'height' => 450 ) );
1045
		} else {
1046
			?>
1047
			<script type="text/javascript">
1048
				( function () {
1049
					var currentScript = document.currentScript;
1050
1051
					// Helper function to load an external script.
1052
					function loadScript( url, cb ) {
1053
						var script = document.createElement( 'script' );
1054
						var prev = currentScript || document.getElementsByTagName( 'script' )[ 0 ];
1055
						script.setAttribute( 'async', true );
1056
						script.setAttribute( 'src', url );
1057
						prev.parentNode.insertBefore( script, prev );
1058
						script.addEventListener( 'load', cb );
1059
					}
1060
1061
					function init() {
@@ 1612-1618 (lines=7) @@
1609
		die();
1610
	}
1611
1612
	public function display_footer() {
1613
		if ( $this->smart ) {
1614
			?><script id="tumblr-js" type="text/javascript" src="https://assets.tumblr.com/share-button.js"></script><?php
1615
		} else {
1616
			$this->js_dialog( $this->shortname, array( 'width' => 450, 'height' => 450 ) );
1617
		}
1618
	}
1619
}
1620
1621
class Share_Pinterest extends Sharing_Source {
@@ 1860-1876 (lines=17) @@
1857
		return $this->build_amp_markup( $attrs );
1858
	}
1859
1860
	function display_footer() {
1861
		if ( $this->smart ) :
1862
		?>
1863
		<script>
1864
		( function () {
1865
			var currentScript = document.currentScript;
1866
1867
			// Don't use Pocket's default JS as it we need to force init new Pocket share buttons loaded via JS.
1868
			function jetpack_sharing_pocket_init() {
1869
				var script = document.createElement( 'script' );
1870
				var prev = currentScript || document.getElementsByTagName( 'script' )[ 0 ];
1871
				script.setAttribute( 'async', true );
1872
				script.setAttribute( 'src', 'https://widgets.getpocket.com/v1/j/btn.js?v=1' );
1873
				prev.parentNode.insertBefore( script, prev );
1874
			}
1875
1876
			if ( document.readyState === 'loading' ) {
1877
				document.addEventListener( 'DOMContentLoaded', jetpack_sharing_pocket_init );
1878
			} else {
1879
				jetpack_sharing_pocket_init();
@@ 2052-2077 (lines=26) @@
2049
		die();
2050
	}
2051
2052
	public function display_footer() {
2053
		if ( $this->smart ) :
2054
			?>
2055
			<script>
2056
				(function(r, d, s) {
2057
					r.loadSkypeWebSdkAsync = r.loadSkypeWebSdkAsync || function(p) {
2058
							var js, sjs = d.getElementsByTagName(s)[0];
2059
							if (d.getElementById(p.id)) { return; }
2060
							js = d.createElement(s);
2061
							js.id = p.id;
2062
							js.src = p.scriptToLoad;
2063
							js.onload = p.callback
2064
							sjs.parentNode.insertBefore(js, sjs);
2065
						};
2066
					var p = {
2067
						scriptToLoad: 'https://swx.cdn.skype.com/shared/v/latest/skypewebsdk.js',
2068
						id: 'skype_web_sdk'
2069
					};
2070
					r.loadSkypeWebSdkAsync(p);
2071
				})(window, document, 'script');
2072
			</script>
2073
			<?php
2074
		else :
2075
			$this->js_dialog( $this->shortname, array( 'width' => 305, 'height' => 665 ) );
2076
		endif;
2077
	}
2078
}
2079