Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Made scripts LibreJS-compliant #1613

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions freesound/static/bw-frontend/build.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// @license magnet:?xt=urn:btih:0b31508aeb0634b347b8270c7bee4d411b5d4109&dn=agpl-3.0.txt AGPL-v3-or-later

const inquirer = require('inquirer');
const shell = require('shelljs');

Expand Down Expand Up @@ -35,3 +37,5 @@ const start = async () => {
};

start();

// @license-end
4 changes: 4 additions & 0 deletions freesound/static/bw-frontend/bw-icons/demo-files/demo.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// @license magnet:?xt=urn:btih:0b31508aeb0634b347b8270c7bee4d411b5d4109&dn=agpl-3.0.txt AGPL-v3-or-later

if (!('boxShadow' in document.body.style)) {
document.body.setAttribute('class', 'noBoxShadow');
}
Expand Down Expand Up @@ -28,3 +30,5 @@ document.body.addEventListener("click", function(e) {
testText.addEventListener('change', updateTest, false);
updateSize();
}());

// @license-end
4 changes: 4 additions & 0 deletions freesound/static/bw-frontend/bw-icons_old/demo-files/demo.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// @license magnet:?xt=urn:btih:0b31508aeb0634b347b8270c7bee4d411b5d4109&dn=agpl-3.0.txt AGPL-v3-or-later

if (!('boxShadow' in document.body.style)) {
document.body.setAttribute('class', 'noBoxShadow');
}
Expand Down Expand Up @@ -28,3 +30,5 @@ document.body.addEventListener("click", function(e) {
testText.addEventListener('change', updateTest, false);
updateSize();
}());

// @license-end
3 changes: 3 additions & 0 deletions freesound/static/bw-frontend/nunjucks.config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
// @license magnet:?xt=urn:btih:0b31508aeb0634b347b8270c7bee4d411b5d4109&dn=agpl-3.0.txt AGPL-v3-or-later

module.exports = {
root: './html'
}

// @license-end
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// @license magnet:?xt=urn:btih:0b31508aeb0634b347b8270c7bee4d411b5d4109&dn=agpl-3.0.txt AGPL-v3-or-later

import {handleGenericModal} from './modal';


Expand All @@ -12,3 +14,5 @@ const bindDownloadSoundButtons = () => {
}

bindDownloadSoundButtons();

// @license-end
4 changes: 4 additions & 0 deletions freesound/static/bw-frontend/src/components/bookmarkSound.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// @license magnet:?xt=urn:btih:0b31508aeb0634b347b8270c7bee4d411b5d4109&dn=agpl-3.0.txt AGPL-v3-or-later

import {handleDismissModal, handleGenericModal} from "./modal";
import {createSelect} from "./select";
import {showToast} from "./toast";
Expand Down Expand Up @@ -69,3 +71,5 @@ const bindBookmarkSoundButtons = () => {
}

bindBookmarkSoundButtons();

// @license-end
4 changes: 4 additions & 0 deletions freesound/static/bw-frontend/src/components/carousel.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// @license magnet:?xt=urn:btih:0b31508aeb0634b347b8270c7bee4d411b5d4109&dn=agpl-3.0.txt AGPL-v3-or-later

import { createIconElement } from '../utils/icons'
import { isTouchEnabledDevice } from './player/utils'

Expand Down Expand Up @@ -98,3 +100,5 @@ carousels.forEach(carousel => {
}
setPage(0)
})

// @license-end
6 changes: 5 additions & 1 deletion freesound/static/bw-frontend/src/components/checkbox.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// @license magnet:?xt=urn:btih:0b31508aeb0634b347b8270c7bee4d411b5d4109&dn=agpl-3.0.txt AGPL-v3-or-later

const addVisibleCheckbox = (checkboxEl) => {

// We want <input type="checkbox" ...> elements to be inside their corresponding <label> element. When rendering
Expand Down Expand Up @@ -34,4 +36,6 @@ const addCheckboxVisibleElements = () => {

addCheckboxVisibleElements();

export default addCheckboxVisibleElements;
export default addCheckboxVisibleElements;

// @license-end
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// @license magnet:?xt=urn:btih:0b31508aeb0634b347b8270c7bee4d411b5d4109&dn=agpl-3.0.txt AGPL-v3-or-later

const collapsableText = document.getElementById('collapsable-text');

const handleCollapsable = () => {
Expand All @@ -16,3 +18,4 @@ if (collapsableText !== null){
collapsableText.addEventListener('click', handleCollapsable);
}

// @license-end
4 changes: 4 additions & 0 deletions freesound/static/bw-frontend/src/components/cookieConsent.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// @license magnet:?xt=urn:btih:0b31508aeb0634b347b8270c7bee4d411b5d4109&dn=agpl-3.0.txt AGPL-v3-or-later

import { getCookie, setCookie } from "../utils/cookies";
import { showToastNoTimeout, dismissToast } from "./toast";

Expand All @@ -10,3 +12,5 @@ if (cookieConsentValue !== "yes") {
dismissToast();
});
}

// @license-end
4 changes: 4 additions & 0 deletions freesound/static/bw-frontend/src/components/djangoMessages.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
// @license magnet:?xt=urn:btih:0b31508aeb0634b347b8270c7bee4d411b5d4109&dn=agpl-3.0.txt AGPL-v3-or-later

import {showToast} from "./toast";

const djangoMessagesContent = document.getElementById('django-messages-content');
if (djangoMessagesContent !== null){
showToast(djangoMessagesContent.innerHTML);
}

// @license-end
4 changes: 4 additions & 0 deletions freesound/static/bw-frontend/src/components/dropdown.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// @license magnet:?xt=urn:btih:0b31508aeb0634b347b8270c7bee4d411b5d4109&dn=agpl-3.0.txt AGPL-v3-or-later

const dropdownToggles = [...document.querySelectorAll('[data-toggle="dropdown"]')];

const lastOpenedDropdown = { toggle: undefined, dropdownOptions: undefined };
Expand Down Expand Up @@ -42,3 +44,5 @@ const toggleExpandDropdown = toggle => {
dropdownToggles.forEach(toggle => {
toggle.addEventListener('click', () => toggleExpandDropdown(toggle));
});

// @license-end
6 changes: 5 additions & 1 deletion freesound/static/bw-frontend/src/components/explicit.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// @license magnet:?xt=urn:btih:0b31508aeb0634b347b8270c7bee4d411b5d4109&dn=agpl-3.0.txt AGPL-v3-or-later

const warningElements = document.getElementsByClassName('explicit-sound-blocker');

warningElements.forEach(element => {
Expand All @@ -8,4 +10,6 @@ warningElements.forEach(element => {
});
element.remove();
});
});
});

// @license-end
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// @license magnet:?xt=urn:btih:0b31508aeb0634b347b8270c7bee4d411b5d4109&dn=agpl-3.0.txt AGPL-v3-or-later

document.addEventListener("DOMContentLoaded", function(){
var formElementsWithDisableOnSubmit = document.getElementsByClassName("disable-on-submit");
for(var i=0; i<formElementsWithDisableOnSubmit.length; i++){
Expand All @@ -15,3 +17,5 @@ document.addEventListener("DOMContentLoaded", function(){
};
}
});

// @license-end
4 changes: 4 additions & 0 deletions freesound/static/bw-frontend/src/components/forumSelect.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// @license magnet:?xt=urn:btih:0b31508aeb0634b347b8270c7bee4d411b5d4109&dn=agpl-3.0.txt AGPL-v3-or-later

/* SELECT FORUM PAGE */

const createForumSelect = () => {
Expand Down Expand Up @@ -92,3 +94,5 @@ then close all select boxes: */
document.addEventListener('click', closeAllSelect);

createForumSelect();

// @license-end
6 changes: 5 additions & 1 deletion freesound/static/bw-frontend/src/components/geotagPicker.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// @license magnet:?xt=urn:btih:0b31508aeb0634b347b8270c7bee4d411b5d4109&dn=agpl-3.0.txt AGPL-v3-or-later

import {makeGeotagEditMap} from '../components/mapsMapbox';
import {showToast} from "./toast";

Expand Down Expand Up @@ -52,4 +54,6 @@ document.addEventListener("DOMContentLoaded", () => {
showGeotagPickerHelpTool(element.dataset.refElementId);
});
});
});
});

// @license-end
6 changes: 5 additions & 1 deletion freesound/static/bw-frontend/src/components/index.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// @license magnet:?xt=urn:btih:0b31508aeb0634b347b8270c7bee4d411b5d4109&dn=agpl-3.0.txt AGPL-v3-or-later

import './dropdown';
import './input';
import './navbar';
Expand All @@ -21,4 +23,6 @@ import './bookmarkSound';
import './similarSoundsModal';
import './cookieConsent';
import './collapsableBlock';
import './autocomplete';
import './autocomplete';

// @license-end
4 changes: 4 additions & 0 deletions freesound/static/bw-frontend/src/components/input.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// @license magnet:?xt=urn:btih:0b31508aeb0634b347b8270c7bee4d411b5d4109&dn=agpl-3.0.txt AGPL-v3-or-later

import { createIconElement } from '../utils/icons'

const searchBoxes = [...document.querySelectorAll('input[type="search"]')]
Expand All @@ -8,3 +10,5 @@ searchBoxes.forEach(searchField => {
searchIconNode.classList.add('input-icon')
inputWrapper.insertBefore(searchIconNode, searchField)
})

// @license-end
4 changes: 4 additions & 0 deletions freesound/static/bw-frontend/src/components/loginModals.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// @license magnet:?xt=urn:btih:0b31508aeb0634b347b8270c7bee4d411b5d4109&dn=agpl-3.0.txt AGPL-v3-or-later

import { showToast } from './toast';

const recoveryAccountBtn = document.getElementById('recovery-account');
Expand All @@ -7,3 +9,5 @@ const handleRecoveryAccount = () => {
};

recoveryAccountBtn.addEventListener('click', handleRecoveryAccount);

// @license-end
6 changes: 5 additions & 1 deletion freesound/static/bw-frontend/src/components/mapsMapbox.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// @license magnet:?xt=urn:btih:0b31508aeb0634b347b8270c7bee4d411b5d4109&dn=agpl-3.0.txt AGPL-v3-or-later

import {stopAllPlayers} from './player/utils'
import {createPlayer} from './player/player-ui'

Expand Down Expand Up @@ -586,4 +588,6 @@ const makeSoundsMapWithStaticMapFirst = (mainWrapperElementId, mapCanvasId, stat
}


export {makeSoundsMap, makeGeotagEditMap, makeSoundsMapWithStaticMapFirst};
export {makeSoundsMap, makeGeotagEditMap, makeSoundsMapWithStaticMapFirst};

// @license-end
4 changes: 4 additions & 0 deletions freesound/static/bw-frontend/src/components/modal.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// @license magnet:?xt=urn:btih:0b31508aeb0634b347b8270c7bee4d411b5d4109&dn=agpl-3.0.txt AGPL-v3-or-later

import {initRegistrationForm, initProblemsLoggingInForm} from "../pages/loginAndRegistration";
import {showToast, showToastNoTimeout, dismissToast} from "./toast";

Expand Down Expand Up @@ -148,3 +150,5 @@ const handleGenericModal = (fetchContentUrl, onLoadedCallback, onClosedCallback,
};

export {handleDismissModal, handleModal, handleGenericModal};

// @license-end
4 changes: 4 additions & 0 deletions freesound/static/bw-frontend/src/components/navbar.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// @license magnet:?xt=urn:btih:0b31508aeb0634b347b8270c7bee4d411b5d4109&dn=agpl-3.0.txt AGPL-v3-or-later

import throttle from 'lodash.throttle';

const navbar = document.getElementsByClassName('bw-nav')[0];
Expand All @@ -20,3 +22,5 @@ const addScrollEventListener = () => {
addScrollEventListener();

export default navbar;

// @license-end
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// @license magnet:?xt=urn:btih:0b31508aeb0634b347b8270c7bee4d411b5d4109&dn=agpl-3.0.txt AGPL-v3-or-later

import playerSettings from './settings'
import { formatAudioDuration, getAudioElementDurationOrDurationProperty } from './utils'
import { createIconElement } from '../../utils/icons'
Expand Down Expand Up @@ -155,3 +157,5 @@ export const createAudioElement = parentNode => {

return audioElement
}

// @license-end
3 changes: 3 additions & 0 deletions freesound/static/bw-frontend/src/components/player/index.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// @license magnet:?xt=urn:btih:0b31508aeb0634b347b8270c7bee4d411b5d4109&dn=agpl-3.0.txt AGPL-v3-or-later

import './player-ui';
import './player-setup';

// @license-end
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// @license magnet:?xt=urn:btih:0b31508aeb0634b347b8270c7bee4d411b5d4109&dn=agpl-3.0.txt AGPL-v3-or-later

import {createPlayer} from "./player-ui";

const setupPlayers = () => {
Expand All @@ -7,3 +9,4 @@ const setupPlayers = () => {

setupPlayers()

// @license-end
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// @license magnet:?xt=urn:btih:0b31508aeb0634b347b8270c7bee4d411b5d4109&dn=agpl-3.0.txt AGPL-v3-or-later

/* eslint-disable no-param-reassign */
import throttle from 'lodash.throttle'
import playerSettings from './settings'
Expand Down Expand Up @@ -417,3 +419,5 @@ const createPlayer = parentNode => {
}

export {createPlayer};

// @license-end
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
// @license magnet:?xt=urn:btih:0b31508aeb0634b347b8270c7bee4d411b5d4109&dn=agpl-3.0.txt AGPL-v3-or-later

export default {
showRemainingTime: false, // show remaining audio time instead of time played
};

// @license-end
4 changes: 4 additions & 0 deletions freesound/static/bw-frontend/src/components/player/utils.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// @license magnet:?xt=urn:btih:0b31508aeb0634b347b8270c7bee4d411b5d4109&dn=agpl-3.0.txt AGPL-v3-or-later

/* eslint-disable import/prefer-default-export */

export const isTouchEnabledDevice = () => {
Expand Down Expand Up @@ -81,3 +83,5 @@ export const getAudioElementDurationOrDurationProperty = (audioElement, parentNo
}
return audioDuration;
}

// @license-end
4 changes: 4 additions & 0 deletions freesound/static/bw-frontend/src/components/propagation.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
// @license magnet:?xt=urn:btih:0b31508aeb0634b347b8270c7bee4d411b5d4109&dn=agpl-3.0.txt AGPL-v3-or-later

const stopPropagations = [...document.querySelectorAll('.stop-propagation')]

stopPropagations.forEach(el => {
el.addEventListener('click', evt => evt.stopPropagation())
})

// @license-end
4 changes: 4 additions & 0 deletions freesound/static/bw-frontend/src/components/radio.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// @license magnet:?xt=urn:btih:0b31508aeb0634b347b8270c7bee4d411b5d4109&dn=agpl-3.0.txt AGPL-v3-or-later

const radios = [...document.querySelectorAll('input.bw-radio')];

const addVisibleRadio = radioEl => {
Expand All @@ -24,3 +26,5 @@ const addVisibleRadio = radioEl => {
};

radios.forEach(addVisibleRadio);

// @license-end
4 changes: 4 additions & 0 deletions freesound/static/bw-frontend/src/components/recaptcha.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// @license magnet:?xt=urn:btih:0b31508aeb0634b347b8270c7bee4d411b5d4109&dn=agpl-3.0.txt AGPL-v3-or-later

const initRecaptchaWidgets = () => {
const recaptchaElements = document.getElementsByClassName('g-recaptcha');
recaptchaElements.forEach(element => {
Expand All @@ -16,3 +18,5 @@ const initRecaptchaWidgets = () => {
};

export default initRecaptchaWidgets;

// @license-end
4 changes: 4 additions & 0 deletions freesound/static/bw-frontend/src/components/select.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// @license magnet:?xt=urn:btih:0b31508aeb0634b347b8270c7bee4d411b5d4109&dn=agpl-3.0.txt AGPL-v3-or-later

function createSelect() {
var select = document.getElementsByTagName('select'),
liElement,
Expand Down Expand Up @@ -127,3 +129,5 @@ function createSelect() {
createSelect();

export {createSelect};

// @license-end
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// @license magnet:?xt=urn:btih:0b31508aeb0634b347b8270c7bee4d411b5d4109&dn=agpl-3.0.txt AGPL-v3-or-later

import {handleGenericModal} from './modal';
import {stopAllPlayers} from './player/utils'
import {createPlayer} from './player/player-ui'
Expand Down Expand Up @@ -45,3 +47,5 @@ bindSimilarSoundButtons();


export {openSimilarSoundsModal};

// @license-end
Loading