instagram_allow_saveimage

Allow "Save image as..." on context menu of Instagram.

Tính đến 01-07-2017. Xem phiên bản mới nhất.

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install an extension such as Tampermonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Userscripts to install this script.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install a user script manager extension to install this script.

(Tôi đã có Trình quản lý tập lệnh người dùng, hãy cài đặt nó!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(I already have a user style manager, let me install it!)

// ==UserScript==
// @name        instagram_allow_saveimage
// @namespace   http://catherine.v0cyc1pp.com/instagram_allow_saveimage.user.js
// @include     https://www.instagram.com/*
// @version     1.10
// @require     http://code.jquery.com/jquery-2.2.4.min.js
// @grant       none
// @run-at      document-end
// @description Allow "Save image as..." on context menu of Instagram.
// @description KNOWN ISSUE: can't save videos.
// ==/UserScript==

this.$ = this.jQuery = jQuery.noConflict(true);


console.log("instagram_allow_saveimage start");


function main() {
	//$("div[is='null']").each(function() {
	$("div").each(function() {


		// Fix: The extension 'Chrome IG Story' is not showing.
		//var parentEls = $(this).parents("#rcr-anchor");
		var parentEls = $(this).parents("article");
		//console.log("parentEls="+parentEls);
		//console.log("parentEls.length="+parentEls.length);
		if ( parentEls !== null && parentEls.length === 0 ) {
			//console.log("Warning: this is the 'story'");
			return;
		}

		var classname = $(this).attr("class");


		var kids = $(this).children();
		console.log("len="+kids.length);
		if ( kids.length === 0 ) {

			var at = $(this).attr("style");
			if ( at !== null && at !== undefined && at !== "" ) {
				console.log("return, this is a style: classname="+classname);
				$(this).attr("display", "inline");
				return;
			}

			/*
			var button = $(this).parent("div").parent("button");
			if ( button === null || button === undefined ) {
				console.log("return, this is a button: classname="+classname);
				return;
			}
			*/

			console.log("hide: classname="+classname);
			$(this).hide();
		} else {
			console.log("show: classname="+classname);
			$(this).removeAttr("style");
		}
	});
	/*
	$("div > a").each(function() {
		var classname = $(this).parent().attr("class");
		console.log("parent classname="+classname);

		var attr = $(this).attr("videoSpritePlayButton");
		console.log("attr="+attr);
		if ( attr === null || attr === undefined || attr === "" ) {
			return;
		}

		console.log("hide: parent classname="+classname);
		$(this).parent().hide();


	});
	$("iframe").each(function() {
		$(this).parent().hide();
	});
	*/
}


var observer = new MutationObserver(function(mutations) {
    observer.disconnect();
    main();
    observer.observe( document, config);
});

var config = { attributes: false, childList: true, characterData: false, subtree:true };

observer.observe( document, config);