User:Vigyani/scripts/INBTalkbackLink.js

In today's world, User:Vigyani/scripts/INBTalkbackLink.js is a topic that has gained great relevance and has generated a wide debate in society. With the advancement of technology and globalization, User:Vigyani/scripts/INBTalkbackLink.js has become a key element that impacts different aspects of daily life. From politics to economics, through culture and education, User:Vigyani/scripts/INBTalkbackLink.js has managed to transform and shape the way we interact and develop in today's world. This is why it is imperative to understand the importance and implications of User:Vigyani/scripts/INBTalkbackLink.js in our daily lives, as well as analyze possible solutions and alternatives to address it effectively.
function tINBTalkbackLink() {
	if($("#mw-content-text").length > 0) {
		var $nodeList = $('a'), pdne = ' (page does not exist)';
		if($nodeList !== null) {
			var i;
			for( i = 0; i < $nodeList.length; i++) {
				var $link = $($nodeList);
					$newLink = $('<a href="#' + $link.title.replace(pdne, "") + '" style="font-size:x-small; display:inline-block;" title="Send a talkback!" noPopup=1 id="TBsubmit' + i + '">TB</a>');
				$newLink.click(function(e) {
					talkbackSubmit2($(this).attr('href').substr(1), this.id)
				});
				$($link).after($newLink);
			}
		}
	$('a').tipsy({html: true}).before("|").after("|");
	}
}
function talkbackSubmit2(page, id) {
	var questionTitle2 = prompt("Please enter the title of the section (or just leave it blank):", ""), sectionTitle = "{{Template:WikiProject India talkback|";
	if (questionTitle2 === null) {
		 $("#"+id).attr("title", 'You canceled the talkback!').tipsy("show");
		 return;
	}
	else if (questionTitle2 === "") {
		sectionTitle += "ts=~~" + "~~}}";
	} 
	else {
		sectionTitle += questionTitle2 + "|ts=~~" + "~~}}";
	}
	var data = {
		format : 'json',
		action : 'edit',
		minor : false,
		title : page,
		text : sectionTitle,
		section : 'new',
		summary : "WikiProject India talkback: you've got messages!",
		token : mw.user.tokens.get('editToken')
	};
	$.ajax({
		url : mw.util.wikiScript('api'),
		type : 'POST',
		dataType : 'json',
		data : data,
		success : function(data) {
			if(data && data.edit && data.edit.result && data.edit.result === 'Success') {
				//window.location = mw.util.getUrl(page);
                                alert("Talkback posted!");
			} else {
				$("#"+id).attr("title", 'There was an error requesting the page edit. Code: ' + data.error.code + '": ' + data.error.info).tipsy("show");
			}
		},
		error : function() {
			$("#"+id).attr("title", 'There was an error using AJAX to edit the page.').tipsy("show");
		}
	});
}
if(mw.config.get('wgPageName') === "Wikipedia talk:Noticeboard for India-related topics") {
	mw.loader.using( 'jquery.tipsy', function () { $(tINBTalkbackLink); } );}