jssocials icon indicating copy to clipboard operation
jssocials copied to clipboard

Title variable is missing from urls

Open skyiron opened this issue 6 years ago • 0 comments

Thank you for jssocials! It is really useful.

I've found that the title variable is missing from shareurls that are supposed to have it. I checked the code, but couldn't find it defined anywhere.

I've been able to add the title variable with the following changes (4th line from top and 3rd line from the bottom).

_initDefaults: function() {
            this.url = window.location.href;
            this.text = $.trim($("meta[name=description]").attr("content") || $("title").text());
	    this.title =$("title").text();          
        },
		
_initShares: function() {
            this.shares = $.map(this.shares, $.proxy(function(shareConfig) {
                if(typeof shareConfig === "string") {
                    shareConfig = { share: shareConfig };
                }

                var share = (shareConfig.share && shares[shareConfig.share]);

                if(!share && !shareConfig.renderer) {
                    throw Error("Share '" + shareConfig.share + "' is not found");
                }

                return $.extend({ url: this.url, text: this.text, title: this.title }, share, shareConfig); 
            }, this));
        },

I've made a pull request for the above changes https://github.com/tabalinas/jssocials/pull/214

skyiron avatar Sep 11 '18 01:09 skyiron