diff options
| author | Nick Colletti <gnomish@gmail.com> | 2020-02-04 16:17:10 -0500 | 
|---|---|---|
| committer | Nick Colletti <gnomish@gmail.com> | 2020-02-04 16:17:10 -0500 | 
| commit | a5f18ece2764670fe05b5461ddd6ec241bc7687c (patch) | |
| tree | c8ce4c93efe50b31cdd9192a2e56101eed49d1ff /js | |
| parent | 9104b0d35c6939d27736bf9bda453733c36a5c61 (diff) | |
| parent | 2294b97365f343f3dd5f36f2a6632b5bca31d148 (diff) | |
Merge branch 'nav-btns' into advanced_mode_with_features
Diffstat (limited to 'js')
| -rw-r--r-- | js/redirectorpage.js | 14 | ||||
| -rw-r--r-- | js/util.js | 8 | 
2 files changed, 20 insertions, 2 deletions
| diff --git a/js/redirectorpage.js b/js/redirectorpage.js index 84bfadf..6d0db2e 100644 --- a/js/redirectorpage.js +++ b/js/redirectorpage.js @@ -277,6 +277,20 @@ function moveDown(index) {  	saveChanges();  } +function moveUpTop(index) { +	let top = REDIRECTS[0]; +	move(REDIRECTS, index, top); +	updateBindings(); +	saveChanges(); +} + +function moveDownBottom(index) { +	let bottom = REDIRECTS.length - 1; +	move(REDIRECTS, index, bottom); +	updateBindings(); +	saveChanges(); +} +  //All the setup stuff for the page  function pageLoad() {  	template = el('#redirect-row-template'); @@ -36,12 +36,12 @@ function dataBind(el, dataObject) {  		}  	}  	for (let tag of el.querySelectorAll('[data-show]')) { -		let shouldShow = boolValue(tag.getAttribute('data-show'));	 +		let shouldShow = boolValue(tag.getAttribute('data-show'));  		tag.style.display = shouldShow ? '' : 'none';  	}  	for (let tag of el.querySelectorAll('[data-disabled]')) {  		let isDisabled = boolValue(tag.getAttribute('data-disabled')); -		 +  		if (isDisabled) {  			tag.classList.add('disabled');  			tag.setAttribute('disabled', 'disabled'); @@ -82,6 +82,10 @@ function showForm(selector, dataObject) {  	show(selector);  } +function move(arr, from, to) { +    arr.splice(to, 0, arr.splice(from, 1)[0]); +} +  function hideForm(selector) {  	hide('#cover');  	hide(selector); | 
