_ _    _ _____  ___   __                       
 __      _(_) | _(_)___ / ( _ ) / /_   ___ ___  _ __ ___  
 \ \ /\ / / | |/ / | |_ \ / _ \| '_ \ / __/ _ \| '_ ` _ \ 
  \ V  V /| |   <| |___) | (_) | (_) | (_| (_) | | | | | |
   \_/\_/ |_|_|\_\_|____/ \___/ \___(_)___\___/|_| |_| |_|

User:Danski454/ToggleSmall.js

This time we are going to enter the fascinating world of User:Danski454/ToggleSmall.js. For a long time, User:Danski454/ToggleSmall.js has been a topic of great interest to multiple sectors of society. Its relevance has transcended over the years, generating debates, research and diverse opinions. In this article, we aim to thoroughly explore the different aspects related to User:Danski454/ToggleSmall.js, from its origins to its impact today. Likewise, we will analyze the role that User:Danski454/ToggleSmall.js plays in our lives and its influence on the world around us. Get ready to immerse yourself in an exciting journey through User:Danski454/ToggleSmall.js, discovering its importance and its multiple implications.
function addTags(tagtype, replacement){
	while ($('#mw-content-text').find('.'+replacement).length !== 0) {
		//console.log('2');
		var tag = $('#mw-content-text .' + replacement).first();
		tag.before('<'+tagtype+'>' + tag.html() + '</'+tagtype+'>');
		tag.remove();
	}
}

function removeTags(tagtype, replacement){
	while ($('#mw-content-text').find(tagtype).length !== 0) {
		//console.log('2');
		var tag = $('#mw-content-text ' + tagtype).first();
		tag.before('<span class="'+replacement+'">' + tag.html() + '</span>');
		tag.remove();
	}
}

var formatting = true;
$(document).ready(function(){
	if( mw.config.get( 'wgIsArticle' )) {//only on non-special view pages
		var portletLink = mw.util.addPortletLink('p-cactions', '#', 'Toggle formatting', 'ca-toggle-fmt', 'Toggle small, large and struck text', '');
		$(portletLink).click(function () {
			if (formatting) {
				removeTags('small', 'toggled_small');
				removeTags('big', 'toggled_big');
				removeTags('s', 'toggled_struck');
				console.log('Cleared formatting');
				formatting = false;
			} else {
				addTags('small', 'toggled_small');
				addTags('big', 'toggled_big');
				addTags('s', 'toggled_struck');
				console.log('Added formatting');
				formatting = true;
			}
		});
	}
});