Misplaced Pages

User:Alexis Jazz/Factotum/modules/AltRefModule.js: Difference between revisions

Article snapshot taken from Wikipedia with creative commons attribution-sharealike license. Give it a read and then ask your questions in the chat. We can research this topic together.
< User:Alexis Jazz | Factotum Next edit →Content deleted Content added
Revision as of 19:33, 30 September 2022 view source Alexis Jazz (talk | contribs)Extended confirmed users, Page movers, File movers, Rollbackers27,974 edits <a href="/Wikipedia:AES" class="mw-redirect" title="Misplaced Pages:AES">←</a>Created page with 'if ( typeof window.BawlModules == 'undefined' ) { window.BawlModules=; }' @Klein Muçi, consider this experimental. I don't wanna support it Next edit →
(No difference)

Revision as of 19:33, 30 September 2022

if ( typeof window.BawlModules == 'undefined' ) { window.BawlModules=; }
FTTModules.push({'load':,'afterPreloadFunc':
	function(int,rInt,errInt){
		FTT.MD.secRefL = {};
		if ( ! FTT.MD.secRefL.CSS ) {
			mw.util.addCSS('#HLSecRefDropDownL>span a{box-shadow:inset 0 0 0 0.15em rgba(0,0,255,0.5)}');
			FTT.MD.secRefL.CSS = 1;
		}
		FTT.MD.secRefL.refs = FTT.UITextInput.getValue().match(/<ref( name="+")?>((|<(?!\/ref>))+)<\/ref>/g);
		if ( ! FTT.MD.secRefL.refs ) {
			return;
		}
		if ( ! FTT.referenceArray ) {
			$('#mw-content-text ol.references').append($('#mw-content-text ol.references>li style')); //sometimes style gets included in innerText but not always? seems flaky, moving style element out of the way
			FTT.referenceArray = Array.from($('#mw-content-text ol.references>li'));
		}
		FTT.MD.secRefL.HLRefDropDownOpts = ;
			for (rInt=0;rInt<FTT.MD.secRefL.refs.length;rInt++) {
			FTT.MD.secRefL.refArrLabel = FTT.MD.secRefL.refs.replace(/<ref( name="+")?>((|<(?!\/ref>))+)<\/ref>/,'$2');
			FTT.MD.secRefL.refArrName = FTT.MD.secRefL.refs.match(/<ref( name="(+)")?>/);
			FTT.MD.secRefL.url = FTT.MD.secRefL.refArrLabel.match(/http?:\/\/+/);
			FTT.MD.secRefL.longNum = FTT.MD.secRefL.refArrLabel.match(/{7,}/);
			FTT.MD.secRefL.gotEl = 0;
			try{
				FTT.MD.secRefL.nameEl = document.getElementById('cite_note-'+FTT.MD.secRefL.refArrName.replace(/ /g,'_')+'-1');
				FTT.MD.secRefL.refArrLabel = FTT.MD.secRefL.nameEl.querySelectorAll('.reference-text').innerText.split(/\n/);
				FTT.MD.secRefL.gotEl=1;
			} catch (e) {}
			if ( ! FTT.MD.secRefL.gotEl ) {
				for (int=0;int<FTT.referenceArray.length;int++) {
					if ( ( FTT.MD.secRefL.url && FTT.referenceArray.innerHTML.match(FTT.MD.secRefL.url) ) || ( FTT.MD.secRefL.longNum && FTT.referenceArray.innerText.match(FTT.MD.secRefL.longNum) ) ) {
						try{
							FTT.MD.secRefL.refArrLabel = FTT.referenceArray.querySelectorAll('.reference-text').innerText.split(/\n/);
							FTT.MD.secRefL.refArrLabelErr = '';
							for ( errInt=0;errInt<FTT.referenceArray.querySelectorAll('.cs1-visible-error').length;errInt++) {
								FTT.MD.secRefL.refArrLabelErr = FTT.MD.secRefL.refArrLabelErr + FTT.referenceArray.querySelectorAll('.cs1-visible-error').innerText;
							}
							FTT.MD.secRefL.refArrLabel = FTT.MD.secRefL.refArrLabelErr + FTT.MD.secRefL.refArrLabel;
						} catch (e) {}
					}
				}
			}
			if ( FTT.MD.secRefL.refArrLabel.length > 120 ) {
				FTT.MD.secRefL.refArrLabel = FTT.MD.secRefL.refArrLabel.slice(0,115)+'…';
			} else {
				FTT.MD.secRefL.refArrLabel = FTT.MD.secRefL.refArrLabel.slice(0,120);
			}
			if ( FTT.MD.secRefL.refArrLabel != '' ) {
				FTT.MD.secRefL.HLRefDropDownOpts.push({data:rInt,label:FTT.MD.secRefL.refArrLabel});
			}
		}
		FTT.MD.secRefL.HLRefDropDown = new OO.ui.DropdownInputWidget( {
			id: 'HLSecRefDropDown',
			classes: ,
			options: FTT.MD.secRefL.HLRefDropDownOpts,
		});
		FTT.MD.secRefL.selectRef = function() {
			FTT.MD.secRefL.refIndexStart = FTT.UITextInput.getValue().split(FTT.MD.secRefL.refs).length;
			FTT.MD.secRefL.refIndexEnd = FTT.MD.secRefL.refIndexStart + FTT.MD.secRefL.refs.length;
			FTT.HLSelectRef(FTT.MD.secRefL.refIndexStart,FTT.MD.secRefL.refIndexEnd);
		};
		FTT.MD.secRefL.HLRefDropDown.on('change',function() {
			FTT.MD.secRefL.selectRef();
		});
		FTT.MD.secRefL.HLRefDropDownGo = new OO.ui.ButtonWidget( {
			label:FTT.basicmsgs.go,
		});
		FTT.MD.secRefL.HLRefDropDownGo.on('click',function(){
			FTT.MD.secRefL.selectRef();
		});
		FTT.MD.secRefL.HLRefDropDownL = new OO.ui.HorizontalLayout({id:'HLSecRefDropDownL',classes:,items:});
		if ( ! FTT.MD.secRefL.HLRefDropDownL.isElementAttached() ) {
			$('#FTTTextAndPreview').append(FTT.MD.secRefL.HLRefDropDownL.$element);
			FTT.insertAfter($('#FTTTextAndPreview'),$('#HLSecRefDropDownL'));
		}
	}
});