Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@Nekaravaev
Last active April 11, 2017 13:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Nekaravaev/bfcc4e64fcd149a9fd83b97d990475e3 to your computer and use it in GitHub Desktop.
Save Nekaravaev/bfcc4e64fcd149a9fd83b97d990475e3 to your computer and use it in GitHub Desktop.
BSUIR sort schedule
function sortSchedule(event) {
let tableSchedule = document.querySelector('table.scheduleStyle'),
subjects = tableSchedule.querySelectorAll('tr.ui-widget-content');
event.preventDefault();
for (let row of subjects) {
if (row.getElementsByTagName('td')[0].style.backgroundColor == 'rgb(255, 216, 218)') {
row.style.display = 'none';
}
}
}
(function() {
let sortButton = document.createElement('button'),
buttonsBlock = document.querySelector('div.semesterBlock'),
spanIcon = document.createElement('span'),
spanText = document.createElement('span');
sortButton.classList.add('ui-button', 'ui-widget', 'ui-state-default', 'ui-corner-all', 'ui-button-text-icon-left', 'printReport');
spanIcon.classList.add('ui-button-icon-left', 'ui-icon', 'ui-c', 'ui-icon-print');
spanText.classList.add('ui-button-text', 'ui-c');
spanIcon.style.backgroundPosition = '-175px -111px';
spanText.innerText = 'Отсортировать';
sortButton.onclick = sortSchedule;
sortButton.appendChild(spanIcon);
sortButton.appendChild(spanText);
buttonsBlock.appendChild(sortButton);
})();
@Nekaravaev
Copy link
Author

Formating

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment