Search is not available for this dataset
query
stringlengths
7
355k
document
stringlengths
9
341k
metadata
dict
negatives
listlengths
0
101
negative_scores
listlengths
0
101
document_score
stringlengths
3
10
document_rank
stringclasses
102 values
change the top carousel items to fit the small window size
function changeFlowItemToFitLargeWindow(i) { deckTitle[i].style.left = "60px"; imageFlowCard[i].style.width = "144px"; imageFlowCard[i].style.height = "166px"; imageFlowCard[i].style.right = "60px"; imageFlowCard[i].style.top = "30px"; deckTitle[i].style.maxWidth = "50%"; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function setHeightCarousel3() {\n $carousel3.each(function () {\n var $allImages = $(this).find('img');\n var size = $(this).attr('data-size') || 0.8;\n var resultH = wndH * size;\n var maxItemW = Math.min($(this).parent().width(), wndW) * size;\n $allI...
[ "0.6966265", "0.6756647", "0.67326427", "0.67141485", "0.6712271", "0.6708533", "0.6708533", "0.6708533", "0.6639458", "0.6630527", "0.65997916", "0.65371406", "0.644696", "0.6425901", "0.6308349", "0.62622744", "0.62332076", "0.6208643", "0.6110219", "0.6070161", "0.60344255...
0.5904775
26
set nav bar back fit bigger size (> 576px)
function spreadNavBar() { for (i = 0; i < userBar.children.length; i++) { userBar.children[i].style.width = ""; } userBar.style.width = ""; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function mbnavresize(){\n\t\tvar browserHeight = $(window).height(); \n\t\t$('#mobile-nav').css(\"height\",browserHeight);\n\t}", "function resize() {\n if ($window.width() < 600) {\n return $nav.addClass('mobile-nav');\n }\n\n $nav.removeClass('mobile-nav');\n ...
[ "0.6847338", "0.6158481", "0.6026186", "0.59826857", "0.59813595", "0.59051234", "0.589477", "0.5889853", "0.5866561", "0.58425844", "0.5840603", "0.5729784", "0.5727374", "0.5681031", "0.5634386", "0.56171983", "0.56153685", "0.55989206", "0.55475205", "0.55397195", "0.55280...
0.0
-1
remove absolute position for nav bar
function removeAbsolutePosition() { userBar.classList.remove("position-absolute"); userBar.style.right = "0px"; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "resetNav() {\n $(\".nav-canvas\").css(\"position\", \"\")\n $(\"#offcanvas-menu-react\").removeClass(\"navslide-hide\")\n $(\".navbar\").removeClass(\"navslide-hide\")\n $(\".nav-canvas\").removeClass(\"navslide-hide\")\n }", "function resetNavbar()\n {\n $(\"#nav-bar\")....
[ "0.671372", "0.62194633", "0.60167515", "0.6008746", "0.5965312", "0.594582", "0.5910057", "0.5903915", "0.59012675", "0.5889023", "0.58834046", "0.58627933", "0.5846785", "0.58407426", "0.5816656", "0.5813924", "0.5813924", "0.5813561", "0.58104885", "0.5809983", "0.57998145...
0.6737305
0
change carousel elements fit the bigger window size
function spreadCarousel(i) { authorDeck[i].style.fontSize = "15px"; deckTitle[i].children[0].classList.remove("h5"); deckTitle[i].style.maxWidth = "50%"; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function adjustSize() {\n const childWidth = carousel.offsetWidth;\n carousel.style.height = childWidth + \"px\";\n carouselInner.style.height = childWidth + \"px\";\n const children = document.querySelectorAll(\".page-item\");\n children.forEach(child => {\n child.style.width = (childWidth / 2) * 0.96 + \...
[ "0.7251054", "0.71811527", "0.7005349", "0.69967544", "0.68612456", "0.68535626", "0.66815627", "0.6639926", "0.6637101", "0.66313964", "0.6604823", "0.6604014", "0.6604014", "0.6604014", "0.65877485", "0.6485035", "0.6479362", "0.639398", "0.6381118", "0.6349011", "0.6294054...
0.587088
77
fetch function logs received data & renders img
function fetchImg() { fetch("https://xkcd.now.sh/?comic=latest") .then((response) => response.json()) .then((data) => { console.log(data); img.src = data.img; }) //logs if an error occurs .catch((err) => console.log(err)); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function fetchImg(){\n fetch(imgUrl)\n .then(resp => resp.json())\n .then(json => json.message.forEach(element => \n addImgToDom(element)\n ));\n}", "function fetchImages(){\n const dogImageContainer = document.querySelector(\"#dog-image-container\")\n fetch(imgUrl, { method: 'GET' })\n .then((respon...
[ "0.76220137", "0.7257569", "0.7170124", "0.69319105", "0.6903238", "0.67679304", "0.6741538", "0.66811144", "0.6650101", "0.6615473", "0.65605325", "0.65182436", "0.6492356", "0.6472035", "0.64686", "0.64657307", "0.6452677", "0.64498097", "0.64253324", "0.631699", "0.6316294...
0.70341665
3
Write a function that determines whether the passed in arrays are similar. Similar means they contain the same elements, and the same number of occurrences of elements. var arr1 = [1, 2, 2, 3, 4], arr2 = [2, 1, 2, 4, 3], arr3 = [1, 2, 3, 4], arr4 = [1, 2, 3, "4"] arraysSimilar(arr1, arr2); // Should equal true arraysSimilar(arr2, arr3); // Should equal false arraysSimilar(arr3, arr4); // Should equal false
function arraysSimilar(arr1, arr2) { if (arr1.length !== arr2.length) return false; arr1.sort(); arr2.sort(); for (let i = 0; i < arr1.length; i++) { if (arr1[i] !== arr2[i]) return false; } return true; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function arraysSimilar(arr1, arr2) {\n \n arr1 = arr1.sort((a, b) => a - b);\n arr2 = arr2.sort((a, b) => a - b);\n \n if (arr1.length > arr2.length) {\n return arr1.every((el, index) => el === arr2[index]);\n } else {\n return arr2.every((el, index) => el === arr1[index]);\n }\n...
[ "0.7854473", "0.7801491", "0.7498858", "0.7266912", "0.71843976", "0.71412563", "0.7140647", "0.71113557", "0.7084376", "0.706554", "0.7052794", "0.70436126", "0.70310944", "0.7012549", "0.69973093", "0.6995364", "0.69826484", "0.6973935", "0.6973935", "0.6973935", "0.6972645...
0.7920142
0
frontend SPA routing function
async function render() { const page = await isomorphicRouter.resolve(location.pathname); if (page.redirect) { window.location = page.redirect; } else { document.body.innerHTML = page.content; if (window.location.pathname === "/") { mainPageFunction(); } else if (window.location.pathname === "/login") { loginFunction(); } else if (window.location.pathname === "/register") { registerFunction(); } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function showHome(request){\n request.serveFile(\"index.html\"); \n}", "bindSPA() {\r\n if (process.env.NODE_ENV !== 'production') return;\r\n const indexPath = path.join(__dirname, '../../public/index.html');\r\n const publicPath = path.join(__dirname, '../../public');\r\n const index = fs.readFi...
[ "0.6692601", "0.6601388", "0.65549296", "0.6467946", "0.62904286", "0.6274216", "0.6139856", "0.60973436", "0.6083141", "0.60679996", "0.6043313", "0.6041538", "0.60323346", "0.60252225", "0.6024456", "0.59553266", "0.5947571", "0.5945766", "0.59270537", "0.592425", "0.587602...
0.56037307
76
let result = [];
function dir(pathname, ext, callback) { // const path = process.argv[2]; // const ext = process.argv[3]; file.readdir(pathname, 'utf8', (err, list) => { const result = list.filter(filename => path.extname(filename) === `.${ext}`); return callback(result); }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "toArray() {}", "toArray() {}", "toArray() {}", "toArray() {\n return [];\n }", "toArray() {\n let arr = [];\n this.map((data) => { arr.push(data); return data});\n return arr;\n }", "asArray() {\n const result = new Array();\n this.toArray(result, 0);\n return...
[ "0.6934184", "0.6934184", "0.6934184", "0.6894386", "0.6685867", "0.66789174", "0.66142255", "0.65533453", "0.65247273", "0.6512517", "0.64939433", "0.6424334", "0.6424334", "0.64064777", "0.6403621", "0.6403621", "0.6403621", "0.63671833", "0.63671833", "0.63671833", "0.6367...
0.0
-1
Notes: Some drawbacks makes inheritance difficult methods are redefined for each new Trail created. All instances should share this method. / / Constructor with Prototypes
function OtherTrail(location, type, distance) { this.location = location; this.type = type; this.distance = distance; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function Trail (obj) {\n this.name = obj.name;\n this.location = obj.location;\n this.stars = obj.stars;\n this.star_votes = obj.star_votes;\n this.summary = obj.summary;\n this.trail_url = obj.url;\n this.conditions = obj.conditionsStatus;\n this.condition_date = obj.conditionDate.slice(0,10);\n this.con...
[ "0.6282079", "0.58154017", "0.5739216", "0.5664521", "0.5664521", "0.56559753", "0.56233734", "0.55981845", "0.55822885", "0.5549351", "0.5526625", "0.551295", "0.5506489", "0.5498839", "0.54565525", "0.54511565", "0.5442098", "0.5440068", "0.5435475", "0.5428987", "0.5425362...
0.52178335
56
This function downloads an XML document from the server, parses it, and presents the parsed document as a DOM tree
function load(url) { var xmlHTTP; if (window.XMLHttpRequest) { xmlHTTP = new XMLHttpRequest(); } else { xmlHTTP = new ActiveXObject("Microsoft.XMLHTTP"); } xmlHTTP.open("GET", url, false); xmlHTTP.send(null); parser = new DOMParser(); xmlDoc = parser.parseFromString(xmlHTTP.responseText, "application/xml"); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function loadXMLDocument( url )\n{\n var xmlHttpRequest = new XMLHttpRequest();\n xmlHttpRequest.open( \"get\", url, false );\n xmlHttpRequest.send( null );\n doc = xmlHttpRequest.responseXML;\n} // end function loadXMLDocument", "function getDoc()\n{\n\n\tvar request = new XMLHttpRequest(); // Create XH...
[ "0.71768", "0.6804874", "0.6602855", "0.6547652", "0.65258425", "0.64092875", "0.6398657", "0.62760615", "0.6272318", "0.61477983", "0.6146318", "0.6143171", "0.6057159", "0.60571164", "0.6019636", "0.6017943", "0.6005374", "0.6004845", "0.5990158", "0.5959289", "0.5927034", ...
0.6762838
2
This function evaluates an XPath expression against the DOM tree of the XML document and returns a text result. It is useful for getting attributes and text values.
function getSimpleText(path) { // For Internet Explorer, use the following... if (window.ActiveXObject) { var node = xmlDoc.selectSingleNode(path); return node.childNodes[0].nodeValue; } // For all other browsers, use the following... else { var snapshot = xmlDoc.evaluate(path, xmlDoc, null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null); return snapshot.snapshotItem(0).textContent; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function processXPathExpression()\n{\n var xpathExpression = document.getElementById( \"inputField\" ).value;\n var result;\n outputHTML = \"\";\n\n if ( !doc.evaluate ) // Internet Explorer \n {\n result = doc.selectNodes( xpathExpression );\n\n for ( var i = 0; i < result.length; i++ )\n ...
[ "0.7010888", "0.700598", "0.67159176", "0.667676", "0.6470711", "0.6457767", "0.6457767", "0.63161707", "0.62877893", "0.6223623", "0.6192896", "0.61636144", "0.61089784", "0.60836095", "0.60622966", "0.6021758", "0.60201186", "0.60201186", "0.5997133", "0.5987372", "0.598437...
0.65196395
4
creates variable d, and queries the text box with id "totalDueBox"
function changeTitle(){ a.textContent = 'Order North Georgia Coffee';// runs the method "textContent" on variable a, setting the header to "Order North Georgia Coffee" }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function totalnoinhousehold () {\n var totalno =\n parseInt($(editemployer + '#adult').val(), 10) +\n parseInt($(editemployer + '#teenager').val(), 10) +\n parseInt($(editemployer + '#children').val(), 10) +\n parseInt($(editemployer + '#infant').val(), 10) +\n parseInt($(editemployer...
[ "0.6048572", "0.6040015", "0.5895402", "0.58916736", "0.5862499", "0.5861643", "0.5794149", "0.57729965", "0.57136565", "0.56961095", "0.56767774", "0.5670846", "0.56694615", "0.56501114", "0.564967", "0.56434727", "0.5632902", "0.562941", "0.5587745", "0.55869925", "0.558327...
0.0
-1
on click, the function changeTitle will be called
function calculatePrice(){ // totalDueBox.value = numberOfBags*pricePerBag+salesTax+shipping; var amount; //if the user selects 3 bags or more, take the shipping price off if (numberOfBags.value >=3){ amount = numberOfBags.value *pricePerBag +numberOfBags.value *pricePerBag * salesTax; } //else keep the shipping price on else { amount = numberOfBags.value *pricePerBag +numberOfBags.value *pricePerBag * salesTax +shipping; } totalDueBox.value = amount; // totalDueBox.value = (numberOfBags.val)*pricePerBag+salesTax+shipping; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "changeTitle( layout, newTitle ){\n\t\tif( layout.title.text ){\n\t\t\tlayout.title.text = newTitle;\n\t\t}\t\n\t}", "function changeTitle(title) {\n document.getElementById (\"quest_title\").innerHTML = title;\n}", "function updateTitle(newTitle) {\r\n $(\"#foodTitle\").text(newTitle.name);\r\n}", "functio...
[ "0.7772806", "0.7590927", "0.7411962", "0.74035287", "0.73989564", "0.73970413", "0.73121536", "0.731", "0.7236662", "0.7232997", "0.7229214", "0.7203418", "0.7201802", "0.7189623", "0.7187209", "0.71486753", "0.7044686", "0.7025807", "0.70059663", "0.70036805", "0.69991136",...
0.0
-1
gestisce la sessione guest dell'utente
async function handleSession() { // ottiene il dato da localStorage const sessionData = localStorage.getItem('mdb_session'); // se sessionData è undefined if (!sessionData) { // crea una nuova sessione const newSessionData = await getGuestSession(); console.log(newSessionData, 'newSessionData'); // se la chiamata getGuestSession ritorna un valore if (newSessionData) { // trasforma in stringa l'oggetto (localStorage può avere solo stringhe) const sessionDataString = JSON.stringify(newSessionData); // aggiunge il valore nel localStorage localStorage.setItem('mdb_session', sessionDataString); // mostra il toastBaner per dare un feedback alll'utente showToast('Hey! Adesso sei registrato come guest'); return true; } return false; } else { // se sessionData ha un valore // trasforma la stringa ottenuta da localSotarge in oggetto o variabile primitiva const parsedSessionData = JSON.parse(sessionData); /** * controlliamo che la sessione non sia scacduta * * la data di scadenza della sessione è contenuta * nell'oggetta della sessione sotto il nome "expires_at" * * utilizziamo Date per verificare se la data di scadenza è inferiore * alla data attuale nel momento in cui sta eseguendo questo codice. * * trasformiamo le due date con getTime() in un numero che corrisponde * ai millisecondi compresi tra la data usata e il 1 gennaio 1970 * (è uno standard per avere una costante di riferimento) * */ const expiresDate = new Date(parsedSessionData.expires_at).getTime(); const nowDate = new Date().getTime(); // se expiresDate in millisecondi è inferiore // a nowDate in millisecondi allora la sessione è scaduta if (expiresDate < nowDate) { // rimuoviamo i dati della sessione del localStorage localStorage.removeItem('mdb_session'); // chiamiamo la funzione stessa per gestire la // creazione di una nuova sessione e l'inserimento nel localStorage await handleSession(); return true; } return true; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function guestLogin()\n{\n localStorage.usr = \"Guest001\";\n localStorage.played = 0;\n localStorage.won = 0;\n localStorage.lost = 0;\n window.location.href = \"lobby.html\";\n}", "allowGuestSignin(allowed) {\n this.guestSessionAllowed_ = allowed;\n }", "function getGuestSession() {\n return new Pr...
[ "0.6464526", "0.6443274", "0.6389303", "0.63694483", "0.6360792", "0.61481714", "0.6103504", "0.6067208", "0.5895888", "0.5894719", "0.5887396", "0.58808404", "0.5871832", "0.5835247", "0.5812096", "0.5811367", "0.5803319", "0.5785709", "0.5777818", "0.57561356", "0.5731551",...
0.65069497
0
Mostra il toast banner per 4s con il messaggio che gli viene passato come parametro
function showToast(text) { TOAST.textContent = text; TOAST.classList.toggle('toast__is-hidden'); setTimeout(() => { TOAST.classList.toggle('toast__is-hidden'); }, 4000); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function mensagemDeAviso(mensagem) {\r\n document.getElementById('mensagemDeErro').innerHTML = `<div class=\"toast shadow-lg mb-5 bg-white rounded\" role=\"alert\" data-delay=\"5000\" aria-atomic=\"true\" style=\"opacity:0.9;\">\r\n <div class=\"toast-header bg-success text-light\">\r\n <span ...
[ "0.7387079", "0.7109056", "0.71022546", "0.70682776", "0.705161", "0.6938772", "0.6925991", "0.6844643", "0.68359923", "0.6807083", "0.6743999", "0.6735134", "0.67110586", "0.670838", "0.6705457", "0.669472", "0.6675874", "0.6656092", "0.66064614", "0.6575781", "0.6560569", ...
0.0
-1
Crea una card per i film / serie tv
function createCard(movie, mediaType) { const carWrapCard = document.createElement('div'); carWrapCard.classList.add('carousel__wrapper-card'); // const flipCardContainer = document.createElement('div'); // flipCardContainer.classList.add('flip-card-container'); // const flipCard = document.createElement('div'); // flipCard.classList.add('flip-card'); // flipCard.dataset.movieId = movie.id; // flipCard.onclick = (evt) => { // evt.preventDefault(); // onClickRenderOnJumbotron(movie.id); // }; // onclick // addToWatchlist.dataset.movieId = movie.id; // addToWatchlist.dataset.movieTitle = movie.original_title; // const carImgInBg = document.createElement('div'); // carImgInBg.style.backgroundImage = `url(${POSTER_BASE_URL}/w185${movie.poster_path})`; // carImgInBg.classList.add('card-img'); // const flipCardFront = document.createElement('div'); // flipCardFront.classList.add('flip-card-front'); // const flipCardBack = document.createElement('div'); // flipCardBack.classList.add('flip-card-back'); // const description = document.createElement('p'); // description.textContent = movie.overview; // const title = document.createElement('h6'); // title.textContent = movie.title || movie.name || movie.original_title || movie.original_name; // console.log(movie.vote_count, movie.vote_average, movie.popularity, movie.genre_ids, movie.original_language, movie.backdrop_path, movie.video); // let genresId = 0; // movie.genre_ids.forEach((genre_id) => { // genresId = genre_id; // }); // for (const genresId of tvGenres) { // console.log(genresId.name); // } // let actionWrapper = createActionBar(movie); // console.log(movie); // flipCardBack.append(title, description); // flipCardFront.appendChild(carImgInBg); // flipCard.appendChild(flipCardFront); // flipCard.appendChild(flipCardBack); // flipCardContainer.appendChild(flipCard); // carWrapCard.appendChild(flipCardContainer); // carWrapCard.appendChild(actionWrapper); // let posCarWrapCard = flipCard.getClientRects(); // console.log(posCarWrapCard); return carWrapCard; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function cardMovieGenerator(movie) {\n const card = document.createElement(\"article\");\n card.classList.add(\"carousel-item\");\n setAttributes(card, {\n onclick: `showModal(${movie.id})`,\n \"data-id\": `${movie.id}`,\n });\n\n card.innerHTML = `\n <img class=\"carousel-item-img\" src=\"${movie.me...
[ "0.68673706", "0.66949195", "0.65294105", "0.65186936", "0.65129286", "0.64891535", "0.6402274", "0.63911545", "0.63787097", "0.63672173", "0.634707", "0.6342534", "0.63131845", "0.6293391", "0.62891006", "0.6288295", "0.625987", "0.6256437", "0.62448025", "0.623835", "0.6234...
0.7277007
0
genera le card per i film presenti nel parametro "list" e li appende dentro il nodo parent passato come secondo parametro "sectionNode"
function renderCarousel(list, sectionNode) { list.forEach((item) => { // ottiene la url dell'immagine completa const imgURL = getImageUrl(item.poster_path); const movieCard = getMovieCard(imgURL, item); sectionNode.appendChild(movieCard); }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function createCards(photographer){\n const sectionCard = elmtFactory(\n \"section\",\n {class:'card'},\n )\n\n const head = elmtFactory('a',\n { href:'photographer-page.html?id='+photographer.id},\n elmtFactory('img',{class:'card_picture', src:'./public/'+photographer.portrait, alt:''},),\n elmt...
[ "0.63207793", "0.61935884", "0.6134472", "0.6095769", "0.6014912", "0.59326345", "0.5922069", "0.5888276", "0.58866423", "0.58226746", "0.5819623", "0.577625", "0.5741258", "0.56826484", "0.5671089", "0.5657915", "0.5654481", "0.5650534", "0.5647578", "0.5637486", "0.5606895"...
0.7291359
0
funzione che ottiene i dati dall'eseterno, e quando li ha ottenuti renderizza il carosello dei film popolari
function handleHTMLMounted() { Promise.all([handleSession(), getConfiguration(), getPopularMovies(false, false, 'movie', 0), getTop_ratedMovies(false, false, 'movie', 1), getNow_playingMovies(false, false, 'movie', 2), getUpcomingMovies(false, false, 'movie', 3)]).then(() => { // ci permette di lavorare con i dati ottenuti dall'esterno renderCarousel(stateMovies[sectionNameId[0]], nodeSectionId[0]); renderCarousel(stateMovies[sectionNameId[1]], nodeSectionId[1]); renderCarousel(stateMovies[sectionNameId[2]], nodeSectionId[2]); renderCarousel(stateMovies[sectionNameId[3]], nodeSectionId[3]); }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function dodajFilm() {\n\n // resetowanie pola jesli tam wczesniej bylo cos wpisane\n parWalidacjaDodanegoFilmu.innerHTML = \"\";\n \n let filmDoDodania = \"\";\n let FilmZweryfikowany = weryfikujFilm();\n \n // weryfikacja dodanego filmu\n // sprawdza czy wczesniej bylo sortowanie\n // ...
[ "0.659589", "0.63849556", "0.63849247", "0.6341519", "0.62649053", "0.62314546", "0.6216256", "0.6191479", "0.61893386", "0.6160423", "0.61096406", "0.6086501", "0.6084515", "0.60821456", "0.60722154", "0.6067023", "0.60588336", "0.6039981", "0.6034579", "0.603136", "0.603086...
0.0
-1
A simple elastic interaction, similar to a spring. Default bounciness is 1, which overshoots a little bit once. 0 bounciness doesn't overshoot at all, and bounciness of N > 1 will overshoot about N times. Wolfram Plots: (default bounciness = 1) (bounciness = 3)
static elastic(bounciness = 1) { const p = bounciness * Math.PI return t => 1 - Math.cos(t * Math.PI / 2) ** 3 * Math.cos(t * p) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "static elastic(bounciness = 1) {\n const p = bounciness * Math.PI;\n return t => 1 - Math.pow(Math.cos((t * Math.PI) / 2), 3) * Math.cos(t * p);\n }", "static elastic(bounciness: number = 1): (t: number) => number {\n const p = bounciness * Math.PI;\n return (t) => 1 - Math.pow(Math.cos(t ...
[ "0.69548124", "0.66649985", "0.605098", "0.5933616", "0.58508927", "0.58099943", "0.5801183", "0.56325525", "0.56229573", "0.5619398", "0.5584909", "0.55843604", "0.55772096", "0.5530642", "0.55055374", "0.5504395", "0.54725903", "0.54433745", "0.54379773", "0.54284495", "0.5...
0.70502025
0
Runs an easing function backwards.
static out(easing) { return t => 1 - easing(1 - t) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function quickBackward() {\n drone.backward(speed)\n setTimeout(function () {\n resetDroneSpeed();\n }, 500)\n}", "function backward() {\n const currProgress = parseInt(progressInp.value, 10);\n\n if ((currProgress - 2000) > 0) {\n progressInp.value = currProgress - 2000;\n } else {\n progressInp....
[ "0.6651149", "0.6422896", "0.6380634", "0.6301122", "0.62642056", "0.6238631", "0.6104038", "0.6072428", "0.6072428", "0.6072428", "0.6072428", "0.6072428", "0.60594076", "0.6054366", "0.6026206", "0.6026206", "0.60204166", "0.5984932", "0.59749687", "0.59485316", "0.5925929"...
0.6446241
1
Makes any easing function symmetrical.
static inOut(easing) { return t => { if (t < 0.5) return easing(t * 2) / 2 return 1 - easing((1 - t) * 2) / 2 } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "static out(easing) {\n return t => 1 - easing(1 - t)\n }", "static out(easing) {\n return t => 1 - easing(1 - t);\n }", "function easing(n) {\r\n return Math.min(0.7, Math.abs(Math.cos(n * rad))) / 0.7;\r\n }", "static inOut(easing) {\n return t => {\n if (t < 0....
[ "0.64032596", "0.6380232", "0.627684", "0.6214854", "0.6098732", "0.60374486", "0.5991297", "0.5986912", "0.5976483", "0.5971845", "0.59415835", "0.59266376", "0.58837193", "0.5804738", "0.57271856", "0.5637966", "0.5629453", "0.56065136", "0.55933946", "0.5587587", "0.556883...
0.60866684
5
on click for dropdown content, generate a park list dropdown for that state.
function parkCodeHandler(parkData) { var parkSelect = $("#park-select").empty(); parkSelect.append($("<option>").text("---").attr("class", "dropdown-item")); $.each(parkData, function (index, value) { var parkOptions = $("<option>") .text(value.fullName) .attr("class", "dropdown-item") .attr("data-lat", value.latitude) .attr("data-lon", value.longitude); $(parkSelect).append(parkOptions); }); parkSelect.on("change", function (event) { event.stopPropagation(); var parkLoc = $(this).find(":selected").data(); lat = parkLoc.lat; lon = parkLoc.lon; nasaCall(lat, lon); weatherCall(lat, lon); }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function generateSelectionMenu() {\n // Iterate through the river info to determine the dropdow groupings\n var selectionGroups = [];\n for(var i=0; i < riverInfo.length; i++) {\n if(i == 0) {\n selectionGroups.push(riverInfo[i].state);\n } else {\n if(selectionGroups.includes(riverInfo[i].state...
[ "0.61500293", "0.61412823", "0.61241835", "0.6082317", "0.6061099", "0.5978562", "0.5946666", "0.5935093", "0.5924162", "0.5910576", "0.5881092", "0.5880342", "0.5874151", "0.58704984", "0.58635503", "0.58559823", "0.5846992", "0.5830114", "0.5821193", "0.58201754", "0.581973...
0.5601229
51
Creates an instance of ActiveToolsMonitor.
constructor() { this.activePcos_ = {}; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function AbrirMonitor()\n{\t \n //Monitor de impresiones\n if(ventana_monitor== null)\t\t\t\n ventana_monitor=\"VentanaMonitor\";\n}", "function ActivityMonitor(options) {\n this._timer = -1;\n this._timeout = -1;\n this._isDisposed = false;\n this._activityStopped = ne...
[ "0.5556235", "0.5354774", "0.52096814", "0.50967574", "0.50787073", "0.4966875", "0.49187744", "0.48538488", "0.4782886", "0.4759273", "0.47186527", "0.46846464", "0.46802112", "0.46760178", "0.46233574", "0.45929107", "0.45793873", "0.45646355", "0.45580322", "0.4535964", "0...
0.0
-1
For each Rope Mastery level, it's 50% easier to struggle out
function StruggleLoad() { StruggleDone = false; StruggleProgress = 0; StruggleSkillBonus = PlayerGetSkillLevel("RopeMastery"); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "levelUpDifficulty() {\n if (gameState.maxNumber < 900) {\n gameState.maxNumber += 5; // Increase the maximum number found in a cell.\n }\n if (gameState.expressNum < 100) {\n gameState.expressNum += 4; // Increase how much the expressions can deviate by.\n }\n }...
[ "0.60184175", "0.5972246", "0.5856036", "0.5744213", "0.5738829", "0.57236266", "0.5716391", "0.5696801", "0.5663769", "0.5652101", "0.5608829", "0.56039137", "0.55734634", "0.557206", "0.55588865", "0.55461144", "0.55424386", "0.55240273", "0.55217904", "0.5487709", "0.54811...
0.0
-1
The next tick to lower the struggle time comes faster with harder levels
function StruggleGetNextTick() { if ((StruggleDifficulty == "Easy") && (StruggleProgress <= 33)) StruggleNextTick = CurrentTime + 600; if ((StruggleDifficulty == "Easy") && (StruggleProgress > 33) && (StruggleProgress <= 66)) StruggleNextTick = CurrentTime + 450; if ((StruggleDifficulty == "Easy") && (StruggleProgress > 66)) StruggleNextTick = CurrentTime + 300; if ((StruggleDifficulty == "Normal") && (StruggleProgress <= 33)) StruggleNextTick = CurrentTime + 400; if ((StruggleDifficulty == "Normal") && (StruggleProgress > 33) && (StruggleProgress <= 66)) StruggleNextTick = CurrentTime + 325; if ((StruggleDifficulty == "Normal") && (StruggleProgress > 66)) StruggleNextTick = CurrentTime + 250; if ((StruggleDifficulty == "Hard") && (StruggleProgress <= 33)) StruggleNextTick = CurrentTime + 300; if ((StruggleDifficulty == "Hard") && (StruggleProgress > 33) && (StruggleProgress <= 66)) StruggleNextTick = CurrentTime + 225; if ((StruggleDifficulty == "Hard") && (StruggleProgress > 66)) StruggleNextTick = CurrentTime + 150; if ((StruggleDifficulty == "Impossible") && (StruggleProgress <= 33)) StruggleNextTick = CurrentTime + 250; if ((StruggleDifficulty == "Impossible") && (StruggleProgress > 33) && (StruggleProgress <= 66)) StruggleNextTick = CurrentTime + 125; if ((StruggleDifficulty == "Impossible") && (StruggleProgress > 66)) StruggleNextTick = CurrentTime + 10; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getNextTick(){tick = tick +1;return tick;}", "function tickTimer() {\n\ttimer = (timer >= speed) ? 0 : timer + 1;\n}", "slowGameTime()\n {\n this.clockTick = this.clockTick / 6;\n if (this.timeIsSlowed)\n {\n this.specialEffects.prepareCanvasLayersForEffects();\n ...
[ "0.6516718", "0.6267585", "0.6107849", "0.60959536", "0.6085638", "0.6081939", "0.6004342", "0.6003031", "0.59818655", "0.5981733", "0.5955449", "0.5951528", "0.59436154", "0.5934066", "0.5903567", "0.58936775", "0.5880527", "0.58787745", "0.5865957", "0.58481747", "0.5837326...
0.6856143
0
When the user clicks to struggle
function StruggleClick(SType, SDifficulty, SMessage, SDoneMessage, SX, SY, SRadius) { // If the user clicked on a struggling point if ((MouseX >= SX - SRadius) && (MouseX <= SX + SRadius) && (MouseY >= SY - SRadius) && (MouseY <= SY + SRadius)) { // If we must start a new struggling if ((SType != StruggleType) || (StruggleDifficultyShown == "")) { StruggleType = SType; StruggleDifficulty = SDifficulty; StruggleDifficultyShown = GetText(SDifficulty); StruggleMessage = SMessage; StruggleDoneMessage = SDoneMessage; StruggleX = SX; StruggleY = SY; StruggleRadius = SRadius; StruggleProgress = 0; StruggleDone = false; StruggleGetNextTick(); } // Raise the progress by 2 for each click, 100 is done if (StruggleProgress <= 0) StruggleProgress = 8; StruggleProgress = StruggleProgress + 2 + StruggleSkillBonus; if (StruggleProgress >= 100) { StruggleProgress = 100; StruggleDone = true; StruggleNextTick = CurrentTime + 6000; } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function humanClicked(event)\n{\n if( origBoard[event.target.id] !== 'O' && origBoard[event.target.id] !== 'X' )\n {\n var status = gameAdvance(event.target.id,human);\n if(status==0 && !checkTie())\n {\n gameAdvance(bestSpot(),computer);\n }\n }\n}", "function noCheat(){\n ...
[ "0.62314314", "0.60242", "0.6021518", "0.59188396", "0.591465", "0.5887501", "0.58401346", "0.582574", "0.58041364", "0.5763264", "0.5757137", "0.5750569", "0.5747151", "0.5740466", "0.5737966", "0.5719068", "0.5713731", "0.5685854", "0.56630284", "0.56554693", "0.5639093", ...
0.6629788
0
Return the correct background image related to the player's progress
function StruggleGetImage(StruggleStage) { // The frame of the image changes faster when progress is higher if (StruggleImageFrameTime < CurrentTime) { if (StruggleProgress <= 0) StruggleImageFrameTime = CurrentTime + 3000; if ((StruggleProgress > 0) && (StruggleProgress <= 33)) StruggleImageFrameTime = CurrentTime + 2000; if ((StruggleProgress > 33) && (StruggleProgress <= 66)) StruggleImageFrameTime = CurrentTime + 1300; if ((StruggleProgress > 66) && (StruggleProgress < 100)) StruggleImageFrameTime = CurrentTime + 800; StruggleImageFrame++; if (StruggleImageFrame > StruggleImageFrameMax) StruggleImageFrame = 0; } if (StruggleProgress >= 100) StruggleImageFrame = StruggleImageFrameMax + 1; // Returns the correct image file if (StruggleProgress <= 0) return CurrentChapter + "/" + CurrentScreen + "/Idle_" + StruggleStage.toString() + "_" + StruggleImageFrame.toString() + ".jpg"; else return CurrentChapter + "/" + CurrentScreen + "/" + StruggleType + "_" + StruggleStage.toString() + "_" + StruggleImageFrame.toString() + ".jpg"; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function onProgress(evt) {\n if (parseInt(evt.duration, 10) === parseInt(evt.position, 10)) {\n $(overlayControls).css('background-img', 'url(http://tempur-pedic.proto.hugeinc.com/video-test/video-controls-play.png)', 'background-size', '10%');\n }\n }", "getBackground...
[ "0.67009574", "0.63075095", "0.62776405", "0.6260093", "0.616654", "0.6065888", "0.59943736", "0.59544724", "0.58843917", "0.5865691", "0.58265716", "0.58157414", "0.58128345", "0.57561475", "0.57494366", "0.5719631", "0.57161677", "0.5712989", "0.5707925", "0.57056236", "0.5...
0.0
-1
Draw the fight progress in the bottom of the fight scene
function StruggleDraw(NoStruggleMessage, StruggleStage) { // Draw the background image DrawImage(StruggleGetImage(StruggleStage), 0, 0); // Draw the struggle text on top if (StruggleProgress <= 0) DrawText(NoStruggleMessage, 600, 30, "white"); if (StruggleProgress >= 100) DrawText(StruggleDoneMessage, 600, 30, "white"); if ((StruggleProgress > 0) && (StruggleProgress < 100)) { DrawText(StruggleMessage, 600, 30, "white"); DrawCircle(StruggleX, StruggleY, StruggleRadius + 4, 4, "white"); } if ((StruggleProgress > 50) && (StruggleProgress < 100)) DrawText(StruggleDifficultyShown, StruggleX, StruggleY + StruggleRadius + 30, "white"); // Draw the progress meter DrawRect(399, 579, 402, 12, "white"); DrawRect(400, 580, StruggleProgress * 4, 10, "#66FF66"); DrawRect(400 + (StruggleProgress * 4), 580, (100 - StruggleProgress) * 4, 10, "red"); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function draw() {\n\t//Redraw Background Color (Necessary?)\n\tbackground(0);\n\n\tfor (let i = 0; i < fishes.length; i++){ \n\t\t// If there is food on the screen, apply attractive force and display food\n\t\tif (food) {\n\t\t\tlet f = food.calculateAttraction(fishes[i]); \n\t\t\tfishes[i].applyForce(f); \n\t\t\t...
[ "0.66108024", "0.66059893", "0.65087074", "0.6458034", "0.64127505", "0.64049536", "0.63743716", "0.63591605", "0.6353695", "0.63489753", "0.6293734", "0.6262873", "0.6226263", "0.6224778", "0.62203366", "0.6215338", "0.62022007", "0.6191622", "0.6188831", "0.6186327", "0.618...
0.0
-1
When the struggle timer runs
function StruggleRun(NoStruggleMessage, StruggleStage) { // When the struggle timer ticks if (StruggleNextTick <= CurrentTime) { // If it's done, we call the done procedure from the calling module, if not we lower the struggle progress if (StruggleDone) { DynamicFunction(CurrentChapter + "_" + CurrentScreen + "_StruggleDone()"); StruggleDone = false; StruggleProgress = 0; StruggleType = ""; } else { StruggleProgress--; if (StruggleProgress < 0) StruggleProgress = 0; StruggleGetNextTick(); } } // Draw the struggle scene StruggleDraw(NoStruggleMessage, StruggleStage); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function timer() {\n footballCrowd();\n timerId = setInterval(() => {\n time--;\n $timer.html(time);\n\n if(time === 0) {\n restart();\n lastPage();\n }\n }, 1000);\n highlightTiles();\n }", "onTik(){\n \n console.log('timer tikking')\n}", "function breakTim...
[ "0.7058319", "0.70026064", "0.6942228", "0.6907968", "0.6835131", "0.67971987", "0.6784356", "0.6698008", "0.66730934", "0.66625625", "0.6644883", "0.6642243", "0.6606459", "0.65906316", "0.6585043", "0.65644354", "0.6556645", "0.65497905", "0.6538009", "0.6535849", "0.652960...
0.6462497
27
checks if user has his own column already and sets properties accordingly
function refreshUserColumns() { //get current columns var userCols = _.map(_.filter($localStorage.columns, { type: 'userFeed'}), 'user'); _.each($scope.users, function(user) { if (userCols.indexOf(user.username) !== -1) { user.hasColumn = true; } else { user.hasColumn = false; } }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "hasColumn(tableName, columnName) {\n let sql =\n 'select * from information_schema.columns where table_name = ? and column_name = ?';\n const bindings = [tableName, columnName];\n\n if (this.schema) {\n sql += ' and table_schema = ?';\n bindings.push(this.schema);\n } else {\n sql +...
[ "0.6035241", "0.6034718", "0.59831727", "0.59749687", "0.59431833", "0.58390737", "0.5812239", "0.57996655", "0.5766", "0.57393545", "0.56383014", "0.5565568", "0.55211943", "0.5511923", "0.5486036", "0.54610777", "0.5449025", "0.5428122", "0.54271585", "0.5407509", "0.540666...
0.67901367
0
Understand Scope. Write Higher Order Functions. Pass Functions As Callbacks. Scope Variable Visbility. The location where a variable is defined dictates where we have access to that variable. Function Scope
function lol() { let person = 'Tom'; const age = 45; var color = 'teal'; console.log(age); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function myFunction(callback) {\n console.log(\"This is myFunction\"); // This is myFunction\n callback(); // This is myCallback\n function myInnerFunction() {\n console.log(\"This is myInnerFunction\");\n }\n myInnerFunction(); // This is myInnerFunction\n}", "function outerFunction (outerArg) { // begi...
[ "0.6458311", "0.6325073", "0.62958777", "0.6288805", "0.62867975", "0.6269847", "0.62111706", "0.62006533", "0.6198064", "0.6187406", "0.61860406", "0.6152954", "0.6139012", "0.6134924", "0.6130482", "0.6127705", "0.61213946", "0.6115675", "0.6108972", "0.60993445", "0.609838...
0.0
-1
you can add any code you want within this function scope
function polybius(input, encode = true) { // create dictionary for decoding input = input.toLowerCase(); const alphabet = "abcdefghijklmnopqrstuvwxyz".split(""); const toFive = ["1", "2", "3", "4", "5"]; let code = []; toFive.forEach((col) => { toFive.forEach((row) => { if (row + col === "42") { code.push("42", "42"); } else { code.push(row + col); } }); }); const polyKey = {}; alphabet.forEach((letter, index) => (polyKey[letter] = code[index])); // Dictionary for decoding created if (encode) { // Encode input based on dictionary let result = ""; for (const letter of input) { if (letter != " ") { result += polyKey[letter]; } else { result += letter; } } return result; } else { // Decode input if (input.replace(/ /g, "").length % 2 != 0) { /* Return false if the length of input minus the spaces is odd because we decode #s in pairs */ return false; } let result = ""; // Split into words input = input.split(" "); // Split input into pairs of strings let codePairs = input.map((string) => string.match(/.{1,2}/g)); let wrdCount = 1; codePairs.forEach((word) => { word.forEach((num) => { if (num === "42") { result += "(i/j)"; } else { // Decrypt letter & add to result result += Object.keys(polyKey).find((key) => polyKey[key] === num); } }); if (codePairs.length > wrdCount) { // If its not the last word add a space between the words result += " "; wrdCount++; } }); return result; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function customFunction() {\n //Statements\n }", "function fn() {\n\t\t }", "function additionalSettings(){\n\n\n}", "function _____SHARED_functions_____(){}", "function exampleFunctionToRun(){\n\n }", "function funcionPorDefinicion(){\n //Body\n }", "function wa(){}", "pri...
[ "0.62623835", "0.6198179", "0.6105098", "0.6009181", "0.5894238", "0.588272", "0.5820974", "0.58202416", "0.580512", "0.58043975", "0.5785289", "0.572518", "0.5722489", "0.5722489", "0.5722489", "0.5717057", "0.5707794", "0.5676393", "0.5665082", "0.56603694", "0.56482315", ...
0.0
-1
if the artist is more than 1 word, add '+' signs inbetween words
function getConcert() { for (var i = 3; i < command.length; i++) { if (i > 3 && i < command.length) { artist = artist + "+" + command[i]; } else { artist += command[i]; } } //if artist exists, run axios function to pull the artist and console log the info //if song does not exsist, console log a message that the artist doesn't exist if (artist !== '') { axios({ method: 'get', //Change API key below url: `https://rest.bandsintown.com/artists/${artist}/events?app_id=codingbootcamp`, responseType: 'json' }).then(function (response) { let showArr = response.data; for (let i = 0; i < showArr.length; i++) { let orgShowDate = showArr[i].datetime; let showDate = moment(orgShowDate).format('L'); console.log(` Lineup: ${showArr[i].lineup} Venue Name: ${showArr[i].venue.name} Venue Location: ${showArr[i].venue.city}, ${showArr[i].venue.country} Show Date: ${showDate} `); fs.appendFile('log.txt', ` Lineup: ${showArr[i].lineup} Venue Name: ${showArr[i].venue.name} Venue Location: ${showArr[i].venue.city}, ${showArr[i].venue.country} Show Date: ${showDate} `, (err) => { if (err) throw err; }); } }).catch(err => { console.log(err); }); } else { console.log("The artist name is not defined. Please try a different artist"); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function add_to_words(words, triplet_words, scale_word) {\n return triplet_words ? triplet_words + ((scale_word && ' ' + scale_word) || '') + ' ' + words : words;\n }", "function combine(prev, word) {\n\n // Loop to find the append string\n // which can be broken into\n for (i = 0; i < prev.length -...
[ "0.6323251", "0.626245", "0.6086326", "0.6073268", "0.6021625", "0.5988574", "0.5925556", "0.5906927", "0.58547896", "0.5849243", "0.58031327", "0.57860357", "0.57566273", "0.57542235", "0.5750625", "0.5748227", "0.5693753", "0.5684746", "0.56772006", "0.5671405", "0.56292886...
0.0
-1
if movie exists, run axios function to pull the artist and console log the info if song does not exsist, pull information for the movie 'Mr. Nobody' uses IMDB API
function getMovie() { for (var i = 3; i < command.length; i++) { if (i > 3 && i < command.length) { movie = movie + "+" + command[i]; } else { movie += command[i]; } } if (movie !== '') { axios({ method: 'get', //Change API key below url: `http://www.omdbapi.com/?apikey=c3f10979&t=${movie}`, responseType: 'json' }).then(function (response) { //console.log(response.data); let dateObj = new Date(response.data.Released); let releaseDate = dateObj.toISOString(); let releaseYear = moment(releaseDate).format('YYYY'); console.log(` Title: ${response.data.Title} Year Released: ${releaseYear} IMDB Rating: ${response.data.Ratings[0].Value} RottenTomatoes Rating: ${response.data.Ratings[1].Value} Country: ${response.data.Country} Language: ${response.data.Language} Plot: ${response.data.Plot} Actors: ${response.data.Actors} `); fs.appendFile('log.txt', ` Title: ${response.data.Title} Year Released: ${releaseYear} IMDB Rating: ${response.data.Ratings[0].Value} RottenTomatoes Rating: ${response.data.Ratings[1].Value} Country: ${response.data.Country} Language: ${response.data.Language} Plot: ${response.data.Plot} Actors: ${response.data.Actors} `, (err) => { if (err) throw err; }); }).catch(err => { console.log(err); }); } else { let movie = 'Mr. Nobody'; axios({ method: 'get', url: `http://www.omdbapi.com/?apikey=c3f10979&t=${movie}`, responseType: 'json' }).then(function (response) { //console.log(response.data); let dateObj = new Date(response.data.Released); let releaseDate = dateObj.toISOString(); let releaseYear = moment(releaseDate).format('YYYY'); console.log(` Title: ${response.data.Title} Released: ${releaseYear} IMDB Rating: ${response.data.Ratings[0].Value} RottenTomatoes Rating: ${response.data.Ratings[1].Value} Country: ${response.data.Country} Language: ${response.data.Language} Plot: ${response.data.Plot} Actors: ${response.data.Actors} `); fs.appendFile('log.txt', ` Title: ${response.data.Title} Year Released: ${releaseYear} IMDB Rating: ${response.data.Ratings[0].Value} RottenTomatoes Rating: ${response.data.Ratings[1].Value} Country: ${response.data.Country} Language: ${response.data.Language} Plot: ${response.data.Plot} Actors: ${response.data.Actors} `, (err) => { if (err) throw err; }); }).catch(err => { console.log(err); }); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function doMovieThis(movie) {\n // If no movie provided, default to Mr. Nobody\n var queryUrl = \"http://www.omdbapi.com/?apikey=trilogy&t=\" + (movie == \"\" ? \"Mr. Nobody\" : movie);\n axios.get(queryUrl)\n .then(function (response) {\n var data = response.data;\n if (data....
[ "0.76526517", "0.7547257", "0.75171465", "0.75153077", "0.75013703", "0.7499233", "0.7487267", "0.748239", "0.7439715", "0.7402306", "0.73898107", "0.7370455", "0.73536515", "0.7351585", "0.73444146", "0.7344135", "0.7297138", "0.7267268", "0.7261334", "0.7257096", "0.7249259...
0.7241575
21
STLYE GRIDS BASED ON USER INPUT Commit Search Button Feature
function commitSearchFunction() { //Calculate Weights for 100km & 30km Grids var source_100km = grid100km.getSource(); var features_100km = source_100km.getFeatures(); var source_30km = grid30km.getSource(); var features_30km = source_30km.getFeatures(); var source_1km_fyn = grid1km_vectorimage_fyn.getSource(); var features_1km_fyn = source_1km_fyn.getFeatures(); var source_1km_hovestad = grid1km_vectorimage_hovestad.getSource(); var features_1km_hovestad = source_1km_hovestad.getFeatures(); var source_1km_midtjylland = grid1km_vectorimage_midtjylland.getSource(); var features_1km_midtjylland = source_1km_midtjylland.getFeatures(); var source_1km_midtjyllandw = grid1km_vectorimage_midtjyllandw.getSource(); var features_1km_midtjyllandw = source_1km_midtjyllandw.getFeatures(); var source_1km_sjælland = grid1km_vectorimage_sjælland.getSource(); var features_1km_sjælland = source_1km_sjælland.getFeatures(); var uni_matchmax = 0; var uni_matchmin = 0; var uni_matchdiff = 0; var cell_int_u = 0; var uni_match_perc = 0; var sch_matchmax = 0; var sch_matchmin = 0; var sch_matchdiff = 0; var cell_int_sch = 0; var sch_match_perc = 0; var coast_matchmax = 0; var coast_matchmin = 0; var coast_matchdiff = 0; var cell_int_coast = 0; var coast_match_perc; var hos_matchmax = 0; var hos_matchmin = 0; var hos_matchdiff = 0; var cell_int_hos = 0; var hos_match_perc = 0; var parks_matchmax = 0; var parks_matchmin = 0; var parks_matchdiff = 0; var cell_int_parks = 0; var parks_match_perc = 0; var roads_matchmax = 0; var roads_matchmin = 0; var roads_matchdiff = 0; var cell_int_roads = 0; var roads_match_perc = 0; var markets_matchmax = 0; var markets_matchmin = 0; var markets_matchdiff = 0; var cell_int_markets = 0; var markets_match_perc = 0; var house_match_perc = 0; var ptst_matchmax = 0; var ptst_matchmin = 0; var ptst_matchdiff = 0; var cell_int_ptst = 0; var ptst_match_perc = 0; var ptsta_matchmax = 0; var ptsta_matchmin = 0; var ptsta_matchdiff = 0; var cell_int_ptsta = 0; var ptsta_match_perc = 0; var resto_matchmax = 0; var resto_matchmin = 0; var resto_matchdiff = 0; var cell_int_resto = 0; var resto_match_perc = 0; var the_matchmax = 0; var the_matchmin = 0; var the_matchdiff = 0; var cell_int_the = 0; var the_match_perc = 0; var cin_matchmax = 0; var cin_matchmin = 0; var cin_matchdiff = 0; var cell_int_cin = 0; var cin_match_perc = 0; var kin_matchmax = 0; var kin_matchmin = 0; var kin_matchdiff = 0; var cell_int_kin = 0; var kin_match_perc = 0; var ind_matchmax = 0; var ind_matchmin = 0; var ind_matchdiff = 0; var cell_int_ind = 0; var ind_match_perc = 0; var wat_matchmax = 0; var wat_matchmin = 0; var wat_matchdiff = 0; var cell_int_wat = 0; var wat_match_perc = 0; var accessibility; var suitability; var livability; features_100km.forEach(function(feature ){ var grid100_id = feature.get("id"); // MATCH PERCENTAGE FOR UNIVERSITIES // When user input doesn't match cell range if ((feature.get("_univers_1")/1000) > parseInt(sliderUni.value)) { uni_matchmax = 0; uni_matchmin = 0; console.log(grid100_id + ": Cell min larger than Uni slider"); } else if (parseInt(sliderUni.value) == (feature.get("_univers_1")/1000)) { uni_matchmax = 0; uni_matchmin = 0; console.log (grid100_id + ": Cell min equal to Uni slider"); } // Getting the maximum matching distance value else if ((feature.get("_univers_2")/1000) == parseInt(sliderUni.value)) { uni_matchmax = (feature.get("_univers_2")/1000); console.log(grid100_id + ": Cell max equal to Uni slider: " + uni_matchmax); } else if ((feature.get("_univers_2")/1000) > parseInt(sliderUni.value)) { uni_matchmax = parseInt(sliderUni.value); console.log(grid100_id + ": Cell max greater than Uni slider: " + uni_matchmax); } else if ((feature.get("_univers_2")/1000) < parseInt(sliderUni.value)) { uni_matchmax = (feature.get("_univers_2")/1000); console.log(grid100_id + ": Cell max smaller than Uni slider: " + uni_matchmax); } // Getting the minimum matching distance value else if ((feature.get("_univers_1")/1000) == 0) { uni_matchmin = 0; console.log(grid100_id + ": Cell min equal to 0: " + uni_matchmin); } else if ((feature.get("_univers_1") /1000 > 0)) { uni_matchmin = (feature.get("_univers_1")/1000); console.log(grid100_id + ": Minimum user slider (0) smaller than cell min: " + uni_matchmin); } // MATCH PERCENTAGE FOR SCHOOLS // When user input doesn 't match cell range if ((feature.get("_schoolsmi")/1000) > parseInt(sliderSchools.value)) { sch_matchmax = 0; sch_matchmin = 0; console.log(grid100_id + ": School min larger than slider"); } else if (parseInt(sliderSchools.value) == (feature.get("_schoolsmi")/1000)) { sch_matchmax = 0; sch_matchmin = 0; console.log(grid100_id + ": School min value equal to slider max"); } // Getting the maximum matching distance value else if ((feature.get("_schoolsma")/1000) == parseInt(sliderSchools.value)) { sch_matchmax = (feature.get("_schoolsma")/1000); console.log(grid100_id + ": School max value equal to slider max"); } else if ((feature.get("_schoolsma")/1000) > parseInt(sliderSchools.value)) { sch_matchmax = parseInt(sliderSchools.value); console.log(grid100_id + ": School max value greater than slider max"); } else if ((feature.get("_schoolsma")/1000) < parseInt(sliderSchools.value)) { sch_matchmax = (feature.get("_schoolsma")/1000); console.log(grid100_id + ": School max value smaller than slider max"); } // Getting the minimum matching distance value else if ((feature.get("_schoolsmi")/1000) == 0) { sch_matchmin = 0; console.log(grid100_id + ": School min value equal to 1"); } else if ((feature.get("_schoolsmi")/1000 > 0)) { sch_matchmin = (feature.get("_schoolsmi")/1000); console.log(grid100_id + ": School slider value smaller than min value"); } // MATCH PERCENTAGE FOR COASTLINE // When user input doesn 't match cell range if ((feature.get("_coastli_1")/1000) > parseInt(sliderCoasts.value)) { coast_matchmax = 0; coast_matchmin = 0; console.log(grid100_id + ": Coast min larger than slider max"); } else if (parseInt(sliderCoasts.value) == (feature.get("_coastli_1")/1000)) { coast_matchmax = 0; coast_matchmin = 0; console.log(grid100_id + ": Coast min value equal to slider max"); } // Getting the maximum matching distance value else if ((feature.get("_coastli_2")/1000) == parseInt(sliderCoasts.value)) { coast_matchmax = (feature.get("_coastli_2")/1000); console.log(grid100_id + ": Coast max value equal to slider max"); } else if ((feature.get("_coastli_2")/1000) > parseInt(sliderSchools.value)) { coast_matchmax = parseInt(sliderCoasts.value); console.log(grid100_id + ": Coast max value greater than slider max"); } else if ((feature.get("_coastli_2")/1000) < parseInt(sliderCoasts.value)) { coast_matchmax = (feature.get("_coastli_2")/1000); console.log(grid100_id + ": Coast max value smaller than slider max"); } // Getting the minimum matching distance value else if ((feature.get("_coastli_1")/1000) == 0) { coast_matchmin = 0; console.log(grid100_id + ": Coast min value equal to 0"); } else if ((feature.get("_coastli_1")/1000 > 0)) { coast_matchmin = (feature.get("_coastli_1")/1000); console.log(grid100_id + ": Coast user slider smaller than cell value"); } // MATCH PERCENTAGE FOR HOSPITALS // When user input doesn 't match cell range if ((feature.get("_hospita_1")/1000) > parseInt(sliderHospitals.value)) { hos_matchmax = 0; hos_matchmin = 0; console.log(grid100_id + ": Hospital min value larger than slider max"); } else if (parseInt(sliderHospitals.value) == (feature.get("_hospita_1")/1000)) { hos_matchmax = 0; hos_matchmin = 0; console.log(grid100_id + ": Hospital min value equal to slider max"); } // Getting the maximum matching distance value else if ((feature.get("_hospita_2")/1000) == parseInt(sliderHospitals.value)) { hos_matchmax = (feature.get("_hospita_2")/1000); console.log(grid100_id + ": Hospital max value equal to slider max"); } else if ((feature.get("_hospita_2")/1000) > parseInt(sliderHospitals.value)) { hos_matchmax = parseInt(sliderHospitals.value); console.log(grid100_id + ": Hospital max value greater than slider max"); } else if ((feature.get("_hospita_2")/1000) < parseInt(sliderHospitals.value)) { hos_matchmax = (feature.get("_hospita_2")/1000); console.log(grid100_id + ": Hospital max value smaller than slider max"); } // Getting the minimum matching distance value else if ((feature.get("_hospita_1")/1000) == 0) { hos_matchmin = 0; console.log(grid100_id + ": Hospital min value equal to 0"); } else if ((feature.get("_hospita_1")/1000 > 0)) { hos_matchmin = (feature.get("_hospita_1")/1000); console.log(grid100_id + ": Hospital slider value smaller than Cell min"); } // MATCH PERCENTAGE FOR LEISURE PARKS // When user input doesn 't match cell range if ((feature.get("_leisure_1")/1000) > parseInt(sliderParks.value)) { parks_matchmax = 0; parks_matchmin = 0; console.log(grid100_id + ": Parks min value larger than slider max"); } else if (parseInt(sliderParks.value) == (feature.get("_leisure_1") /1000)) { parks_matchmax = 0; parks_matchmin = 0; console.log(grid100_id + ": Parks min value equal to slider max"); } // Getting the maximum matching distance value else if ((feature.get("_leisure_2")/1000) == parseInt(sliderParks.value)) { parks_matchmax = (feature.get("_leisure_2")/1000); console.log(grid100_id + ": Parks max value equal to slider max"); } else if ((feature.get("_leisure_2")/1000) > parseInt(sliderParks.value)) { parks_matchmax = parseInt(sliderParks.value); console.log(grid100_id + ": Parks max value greater than slider max"); } else if ((feature.get("_leisure_2")/1000) < parseInt(sliderParks.value)) { parks_matchmax = (feature.get("_leisure_2")/1000); console.log(grid100_id + ": Parks max value smaller than Parks slider max"); } // Getting the minimum matching distance value else if ((feature.get("_leisure_1")/1000) == 0) { parks_matchmin = 0; console.log(grid100_id + ":Parks min value equal to 0"); } else if ((feature.get("_leisure_1")/1000 > 0)) { parks_matchmin = (feature.get("_leisure_1")/1000); console.log(grid100_id + ": Parks slider value smaller than cell min "); } // MATCH PERCENTAGE FOR ROADS // When user input doesn 't match cell range if ((feature.get("_roadsmin")/1000) > parseInt(sliderRoads.value)) { roads_matchmax = 0; roads_matchmin = 0; console.log(grid100_id + ": Roads min value larger than slider max"); } else if (parseInt(sliderRoads.value) == (feature.get("_roadsmin")/1000)) { roads_matchmax = 0; roads_matchmin = 0; console.log(grid100_id + ": Roads min value equal to slider max"); } // Getting the maximum matching distance value else if ((feature.get("_roadsmax")/1000) == parseInt(sliderRoads.value)) { roads_matchmax = (feature.get("_roadsmax")/1000); console.log(grid100_id + ": Roads max value equal to slider max"); } else if ((feature.get("_roadsmax")/1000) > parseInt(sliderRoads.value)) { roads_matchmax = parseInt(sliderRoads.value); console.log(grid100_id + ": Roads max value greater than slider max"); } else if ((feature.get("_roadsmax")/1000) < parseInt(sliderRoads.value)) { roads_matchmax = (feature.get("_roadsmax")/1000); console.log(grid100_id + ": Roads max value smaller than slider max"); } // Getting the minimum matching distance value else if ((feature.get("_roadsmin")/1000) == 0) { roads_matchmin = 0; console.log(grid100_id + ": Roads min value equal to 0"); } else if ((feature.get("_roadsmin")/1000 > 0)) { roads_matchmin = (feature.get("_roadsmin")/1000); console.log(grid100_id + ": Roads slider value smaller than cell min"); } // MATCH PERCENTAGE FOR SUPERMARKETS // When user input doesn 't match cell range if ((feature.get("_superma_1")/1000) > parseInt(sliderMarkets.value)) { markets_matchmax = 0; markets_matchmin = 0; console.log(grid100_id + ": Markets min value larger than slider max"); } else if (parseInt(sliderMarkets.value) == (feature.get("_superma_1")/1000)) { markets_matchmax = 0; markets_matchmin = 0; console.log(grid100_id + ": Markets min value equal to slider max"); } // Getting the maximum matching distance value else if ((feature.get("_superma_2")/1000) == parseInt(sliderMarkets.value)) { markets_matchmax = (feature.get("_superma_2")/1000); console.log(grid100_id + ": Markets max value equal to slider max"); } else if ((feature.get("_superma_2")/1000) > parseInt(sliderMarkets.value)) { markets_matchmax = parseInt(sliderMarkets.value); console.log(grid100_id + ": Markets max value greater than slider max"); } else if ((feature.get("_superma_2")/1000) < parseInt(sliderMarkets.value)) { markets_matchmax = (feature.get("_superma_2")/1000); console.log(grid100_id + ": Market max value smaller than slider max"); } // Getting the minimum matching distance value else if ((feature.get("_superma_1")/1000) == 0) { markets_matchmin = 0; console.log(grid100_id + ": Markets min value equal to 1"); } else if ((feature.get("_superma_1")/1000 > 0)) { markets_matchmin = (feature.get("_superma_1")/1000); console.log(grid100_id + ": Markets slider value smaller than cell min"); } // MATCH PERCENTAGE FOR PUBLIC TRANSPORT STOPS // When user input doesn't match cell range if ((feature.get("_pt_stop_1")/1000) > parseInt(sliderPstops.value)) { ptst_matchmax = 0; ptst_matchmin = 0; console.log(grid100_id + ": Cell min larger than PT stops slider"); } else if (parseInt(sliderPstops.value) == (feature.get("_pt_stop_1")/1000)) { ptst_matchmax = 0; ptst_matchmin = 0; console.log (grid100_id + ": Cell min equal to PT stops slider"); } // Getting the maximum matching distance value else if ((feature.get("_pt_stop_2")/1000) == parseInt(sliderPstops.value)) { ptst_matchmax = (feature.get("_pt_stop_2")/1000); console.log(grid100_id + ": Cell max equal to PT stops slider"); } else if (( feature.get("_pt_stop_2")/1000) > parseInt(sliderPstops.value)) { ptst_matchmax = parseInt(sliderPstops.value); console.log(grid100_id + ": Cell max greater than PT stops slider"); } else if ((feature.get("_pt_stop_2")/1000) < parseInt(sliderPstops.value)) { ptst_matchmax = (feature.get("_pt_stop_2")/1000); console.log(grid100_id + ": Cell max smaller than PT stops slider"); } // Getting the minimum matching distance value else if ((feature.get("_pt_stop_1")/1000) == 0) { ptst_matchmin = 0; console.log(grid100_id + ": Cell min equal to 0."); } else if ((feature.get("_pt_stop_1") /1000 > 0)) { ptst_matchmin = (feature.get("_pt_stop_1")/1000); console.log(grid100_id + ": Minimum user slider (0) smaller than cell min."); } // MATCH PERCENTAGE FOR PUBLIC TRANSPORT STATIONS // When user input doesn't match cell range if ((feature.get("_pt_stat_1")/1000) > parseInt(sliderPstations.value)) { ptsta_matchmax = 0; ptsta_matchmin = 0; console.log(grid100_id + ": Cell min larger than PT stations slider"); } else if (parseInt(sliderPstations.value) == (feature.get("_pt_stat_1")/1000)) { ptsta_matchmax = 0; ptsta_matchmin = 0; console.log (grid100_id + ": Cell min equal to PT stations slider"); } // Getting the maximum matching distance value else if ((feature.get("_pt_stat_2")/1000) == parseInt(sliderPstations.value)) { ptsta_matchmax = (feature.get("_pt_stat_2")/1000); console.log(grid100_id + ": Cell max equal to PT stations slider"); } else if (( feature.get("_pt_stat_2")/1000) > parseInt(sliderPstations.value)) { ptsta_matchmax = parseInt(sliderPstations.value); console.log(grid100_id + ": Cell max greater than PT stations slider"); } else if ((feature.get("_pt_stations_2")/1000) < parseInt(sliderPstations.value)) { ptsta_matchmax = (feature.get("_pt_stat_2")/1000); console.log(grid100_id + ": Cell max smaller than PT stations slider"); } // Getting the minimum matching distance value else if ((feature.get("_pt_stat_1")/1000) == 0) { ptsta_matchmin = 0; console.log(grid100_id + ": Cell min equal to 0."); } else if ((feature.get("_pt_stat_1") /1000 > 0)) { ptsta_matchmin = (feature.get("_pt_stat_1")/1000); console.log(grid100_id + ": Minimum user slider (0) smaller than cell min."); } // MATCH PERCENTAGE FOR RESTAURANTS // When user input doesn 't match cell range if ((feature.get("_restaur_1")/1000) > parseInt(sliderRestuarants.value)) { resto_matchmax = 0; resto_matchmin = 0; console.log(grid100_id + ": Resto min larger than slider max"); } else if (parseInt(sliderRestuarants.value) == (feature.get("_restaur_1")/1000)) { resto_matchmax = 0; resto_matchmin = 0; console.log(grid100_id + ": Resto min value equal to slider max"); } // Getting the maximum matching distance value else if ((feature.get("_restaur_2")/1000) == parseInt(sliderRestuarants.value)) { resto_matchmax = (feature.get("_restaur_2")/1000); console.log(grid100_id + ": Resto max value equal to slider max"); } else if ((feature.get("_restaur_2")/1000) > parseInt(sliderRestuarants.value)) { resto_matchmax = parseInt(sliderRestuarants.value); console.log(grid100_id + ": Resto max value greater than slider max"); } else if ((feature.get("_restaur_2")/1000) < parseInt(sliderRestuarants.value)) { resto_matchmax = (feature.get("_restaur_2")/1000); console.log(grid100_id + ": Resto max value smaller than slider max"); } // Getting the minimum matching distance value else if ((feature.get("_restaur_1")/1000) == 0) { resto_matchmin = 0; console.log(grid100_id + ": Resto min value equal to 0"); } else if ((feature.get("_restaur_1")/1000 > 0)) { resto_matchmin = (feature.get("_restaur_1")/1000); console.log(grid100_id + ": Resto user slider smaller than cell value"); } // MATCH PERCENTAGE FOR THEATRES // When user input doesn 't match cell range if ((feature.get("_theatre_1")/1000) > parseInt(sliderTheatres.value)) { the_matchmax = 0; the_matchmin = 0; console.log(grid100_id + ": Theatres min larger than slider max"); } else if (parseInt(sliderTheatres.value) == (feature.get("_theatre_1")/1000)) { the_matchmax = 0; the_matchmin = 0; console.log(grid100_id + ": Theatres min value equal to slider max"); } // Getting the maximum matching distance value else if ((feature.get("_theatre_2")/1000) == parseInt(sliderTheatres.value)) { the_matchmax = (feature.get("_theatre_2")/1000); console.log(grid100_id + ": Theatres max value equal to slider max"); } else if ((feature.get("_theatre_2")/1000) > parseInt(sliderTheatres.value)) { the_matchmax = parseInt(sliderTheatres.value); console.log(grid100_id + ": Theatres max value greater than slider max"); } else if ((feature.get("_theatre_2")/1000) < parseInt(sliderTheatres.value)) { the_matchmax = (feature.get("_theatre_2")/1000); console.log(grid100_id + ": Theatres max value smaller than slider max"); } // Getting the minimum matching distance value else if ((feature.get("_theatre_1")/1000) == 0) { the_matchmin = 0; console.log(grid100_id + ": Theatres min value equal to 0"); } else if ((feature.get("_theatre_1")/1000 > 0)) { the_matchmin = (feature.get("_theatre_1")/1000); console.log(grid100_id + ": Theatres user slider smaller than cell value"); } // MATCH PERCENTAGE FOR CINEMAS // When user input doesn 't match cell range if ((feature.get("_cinemasmi")/1000) > parseInt(sliderCinemas.value)) { cin_matchmax = 0; cin_matchmin = 0; console.log(grid100_id + ": Cinemas min value larger than slider max"); } else if (parseInt(sliderCinemas.value) == (feature.get("_cinemasmi")/1000)) { cin_matchmax = 0; cin_matchmin = 0; console.log(grid100_id + ": Cinemas min value equal to slider max"); } // Getting the maximum matching distance value else if ((feature.get("_cinemasma")/1000) == parseInt(sliderCinemas.value)) { cin_matchmax = (feature.get("_cinemasma")/1000); console.log(grid100_id + ": Cinemas max value equal to slider max"); } else if ((feature.get("_cinemasma")/1000) > parseInt(sliderCinemas.value)) { cin_matchmax = parseInt(sliderCinemas.value); console.log(grid100_id + ": Cinemas max value greater than slider max"); } else if ((feature.get("_cinemasma")/1000) < parseInt(sliderCinemas.value)) { cin_matchmax = (feature.get("_cinemasma")/1000); console.log(grid100_id + ": Cinemas max value smaller than slider max"); } // Getting the minimum matching distance value else if ((feature.get("_cinemasmi")/1000) == 0) { cin_matchmin = 0; console.log(grid100_id + ": Cinemas min value equal to 0"); } else if ((feature.get("_cinemasmi")/1000 > 0)) { cin_matchmin = (feature.get("_cinemasmi")/1000); console.log(grid100_id + ": Cinemas slider value smaller than cell min"); } // MATCH PERCENTAGE FOR KINDERGARTENS // When user input doesn 't match cell range if ((feature.get("_kindermin")/1000) > parseInt(sliderKinder.value)) { kin_matchmax = 0; kin_matchmin = 0; console.log(grid100_id + ": Kinder min value larger than slider max"); } else if (parseInt(sliderKinder.value) == (feature.get("_kindermin")/1000)) { kin_matchmax = 0; kin_matchmin = 0; console.log(grid100_id + ": Kinder min value equal to slider max"); } // Getting the maximum matching distance value else if ((feature.get("_kindermax")/1000) == parseInt(sliderKinder.value)) { kin_matchmax = (feature.get("_kindermax")/1000); console.log(grid100_id + ": Kinder max value equal to slider max"); } else if ((feature.get("_kindermax")/1000) > parseInt(sliderKinder.value)) { kin_matchmax = parseInt(sliderKinder.value); console.log(grid100_id + ": Kinder max value greater than slider max"); } else if ((feature.get("_kindermax")/1000) < parseInt(sliderKinder.value)) { kin_matchmax = (feature.get("_kindermax")/1000); console.log(grid100_id + ": Kinder max value smaller than slider max"); } // Getting the minimum matching distance value else if ((feature.get("_kindermin")/1000) == 0) { kin_matchmin = 0; console.log(grid100_id + ": Kinder min value equal to 0"); } else if ((feature.get("_kindermin")/1000 > 0)) { kin_matchmin = (feature.get("_kindermin")/1000); console.log(grid100_id + ": Kinder slider value smaller than cell min"); } // MATCH PERCENTAGE FOR INDUSTRIES // When user input doesn 't match cell range if ((feature.get("_industr_1")/1000) > parseInt(sliderIndustry.value)) { ind_matchmax = 0; ind_matchmin = 0; console.log(grid100_id + ": Indu min larger than slider max"); } else if (parseInt(sliderIndustry.value) == (feature.get("_industr_1")/1000)) { ind_matchmax = 0; ind_matchmin = 0; console.log(grid100_id + ": Indu min value equal to slider max"); } // Getting the maximum matching distance value else if ((feature.get("_industr_2")/1000) == parseInt(sliderIndustry.value)) { ind_matchmax = (feature.get("_industr_2")/1000); console.log(grid100_id + ": Indu max value equal to slider max"); } else if ((feature.get("_industr_2")/1000) > parseInt(sliderIndustry.value)) { ind_matchmax = parseInt(sliderIndustry.value); console.log(grid100_id + ": Indu max value greater than slider max"); } else if ((feature.get("_industr_2")/1000) < parseInt(sliderIndustry.value)) { ind_matchmax = (feature.get("_industr_2")/1000); console.log(grid100_id + ": Indu max value smaller than slider max"); } // Getting the minimum matching distance value else if ((feature.get("_industr_1")/1000) == 0) { ind_matchmin = 0; console.log(grid100_id + ": Indu min value equal to 0"); } else if ((feature.get("_industr_1")/1000 > 0)) { ind_matchmin = (feature.get("_industr_1")/1000); console.log(grid100_id + ": Indu user slider smaller than cell value"); } // MATCH PERCENTAGE FOR WATER BODIES // When user input doesn 't match cell range if ((feature.get("_waterbo_1")) > parseInt(sliderWater.value)) { wat_matchmax = 0; wat_matchmin = 0; } else if (parseInt(sliderWater.value) == (feature.get("_waterbo_1"))) { wat_matchmax = 0; wat_matchmin = 0; } // Getting the maximum matching distance value else if ((feature.get("_waterbo_2")) == parseInt(sliderWater.value)) { wat_matchmax = (feature.get("_waterbo_2")); } else if ((feature.get("_waterbo_2")) > parseInt(sliderWater.value)) { wat_matchmax = parseInt(sliderWater.value); } else if ((feature.get("_waterbo_2")) < parseInt(sliderWater.value)) { wat_matchmax = (feature.get("_waterbo_2")); } // Getting the minimum matching distance value else if ((feature.get("_waterbo_1")) == 0) { wat_matchmin = 0; } else if ((feature.get("_waterbo_1")) > 0){ wat_matchmin = (feature.get("_waterbo_1")); } // MATCH PERCENTAGE FOR HOUSE PRICES if ((feature.get("housepri_2")) > parseInt(sliderHprice.value)) { house_match_perc = 0; //Out of the cell interval } else {(((feature.get("housepri_2") == parseInt(sliderHprice.value)) || (parseInt(sliderHprice.value) > (feature.get("housepri_2"))))) house_match_perc = 100; //Within the cell interval } //UNIVERSITIES matching percentage uni_matchdiff = (uni_matchmax - uni_matchmin); cell_int_u = (feature.get("_univers_2")/1000) - (feature.get("_univers_1")/1000); // Getting the match percentage uni_match_perc = (uni_matchdiff * 100) / cell_int_u; console.log(grid100_id + ": Uni Match %: " + uni_match_perc); //SCHOOLS matching percentage sch_matchdiff = (sch_matchmax - sch_matchmin); cell_int_sch = (feature.get("_schoolsma")/1000) - (feature.get("_schoolsmi")/1000); // Getting the match percentage sch_match_perc = (sch_matchdiff * 100) / cell_int_sch; console.log(grid100_id + ": Schools Match %: " + sch_match_perc); //COASTLINE matching percentage coast_matchdiff = (coast_matchmax - coast_matchmin); cell_int_coast = (feature.get("_coastli_2")/1000) - (feature.get("_coastli_1")/1000); // Getting the match percentage coast_match_perc = (coast_matchdiff * 100) / cell_int_coast; console.log(grid100_id + ": Coasts Match %: " + coast_match_perc); //HOSPITALS matching percentage hos_matchdiff = (hos_matchmax - hos_matchmin); cell_int_hos = (feature.get("_hospita_2")/1000) - (feature.get("_hospita_1")/1000); // Getting the match percentage hos_match_perc = (hos_matchdiff * 100) / cell_int_hos; console.log(grid100_id + ": Hospitals Match %: " + hos_match_perc); //PARKS matching percentage parks_matchdiff = (parks_matchmax - parks_matchmin); cell_int_parks = (feature.get("_leisure_2")/1000) - (feature.get("_leisure_1")/1000); // Getting the match percentage parks_match_perc = (parks_matchdiff * 100) / cell_int_parks; console.log(grid100_id + ": Parks Match %: " + parks_match_perc); // ROADS matching percentage roads_matchdiff = (roads_matchmax - roads_matchmin); cell_int_roads = (feature.get("_roadsmax")/1000) - (feature.get("_roadsmin")/1000); // Getting the match percentage roads_match_perc = (roads_matchdiff * 100) / cell_int_roads; console.log(grid100_id + ": Roads Match %: " + roads_match_perc); // SUPERMARKETS matching percentage markets_matchdiff = (markets_matchmax - markets_matchmin); cell_int_markets = (feature.get("_superma_2")/1000) - (feature.get("_superma_1")/1000); // Getting the match percentage markets_match_perc = (markets_matchdiff * 100) / cell_int_markets; console.log(grid100_id + ": Markets Match %: " + markets_match_perc); // PUBLIC TRANSPORT STOPS matching percentage ptst_matchdiff = (ptst_matchmax - ptst_matchmin); cell_int_ptst = (feature.get("_pt_stop_2")/1000) - (feature.get("_pt_stop_1")/1000); // Getting the match percentage ptst_match_perc = (ptst_matchdiff * 100) / cell_int_ptst; console.log(grid100_id + ": PT Stops Match %: " + ptst_match_perc); // PUBLIC TRANSPORT STATIONS matching percentage ptsta_matchdiff = (ptsta_matchmax - ptsta_matchmin); cell_int_ptsta = (feature.get("_pt_stat_2")/1000) - (feature.get("_pt_stat_1")/1000); // Getting the match percentage ptsta_match_perc = (ptsta_matchdiff * 100) / cell_int_ptsta; console.log(grid100_id + ": PT Stats Match %: " + ptsta_match_perc); // RESTAURANTS matching percentage resto_matchdiff = (resto_matchmax - resto_matchmin); cell_int_resto = (feature.get("_restaur_2")/1000) - (feature.get("_restaur_1")/1000); // Getting the match percentage resto_match_perc = (resto_matchdiff * 100) / cell_int_resto; console.log(grid100_id + ": Restaurants Match %: " + resto_match_perc); // THEATRES matching percentage the_matchdiff = (the_matchmax - the_matchmin); cell_int_the = (feature.get("_theatre_2")/1000) - (feature.get("_theatre_1")/1000); // Getting the match percentage the_match_perc = (the_matchdiff * 100) / cell_int_the; console.log(grid100_id + ": Theatres Match %: " + the_match_perc); // CINEMAS matching percentage cin_matchdiff = (cin_matchmax - cin_matchmin); cell_int_cin = (feature.get("_cinemasma")/1000) - (feature.get("_cinemasmi")/1000); // Getting the match percentage cin_match_perc = ( cin_matchdiff * 100) / cell_int_cin; console.log(grid100_id + ": Cinemas Match %: " + cin_match_perc); // KINDERGARTENS matching percentage kin_matchdiff = (kin_matchmax - kin_matchmin); cell_int_kin = (feature.get("_kindermax")/1000) - (feature.get("_kindermin")/1000); // Getting the match percentage kin_match_perc = (kin_matchdiff * 100) / cell_int_kin; console.log(grid100_id + ": Kinder Match %: " + kin_match_perc); // INDUSTRIES matching percentage ind_matchdiff = (ind_matchmax - ind_matchmin); cell_int_ind = (feature.get("_industr_2")/1000) - (feature.get("_industr_1")/1000); // Getting the match percentage ind_match_perc = (ind_matchdiff * 100) / cell_int_ind; console.log(grid100_id + ": Industries Match %: " + ind_match_perc); // WATER BODIES matching percentage wat_matchdiff = (wat_matchmax - wat_matchmin); cell_int_wat = (feature.get("_waterbo_2")/1000) - (feature.get("_waterbo_1")/1000); // Getting the match percentage wat_match_perc = (wat_matchdiff * 100) / cell_int_wat; // OVERALL PERCENTAGE CELL MATCH var new_fuzzy_value_100km = (ind_matchdiff + kin_matchdiff + cin_matchdiff + the_matchdiff + ptsta_matchdiff + ptst_matchdiff + resto_matchdiff + markets_matchdiff + roads_matchdiff + parks_matchdiff + uni_matchdiff + sch_matchdiff + coast_matchdiff + hos_matchdiff + wat_matchdiff)/ (cell_int_ind + cell_int_kin + cell_int_cin + cell_int_the + cell_int_resto + cell_int_ptsta + cell_int_ptst + cell_int_markets + cell_int_coast + cell_int_hos + cell_int_parks + cell_int_u + cell_int_sch + cell_int_roads + cell_int_wat); feature.set("fuzzyvalue", new_fuzzy_value_100km); console.log("Cell " + grid100_id + " Fuzzy Value: " + new_fuzzy_value_100km); accessibility = (((roads_matchdiff + ptsta_matchdiff + ptst_matchdiff)*100 / (cell_int_ptsta + cell_int_ptst + cell_int_roads))); livability = ((ind_matchdiff + kin_matchdiff + cin_matchdiff + the_matchdiff + resto_matchdiff + markets_matchdiff + parks_matchdiff + uni_matchdiff + sch_matchdiff + coast_matchdiff + hos_matchdiff + wat_matchdiff) * 100) / (cell_int_ind + cell_int_kin + cell_int_cin + cell_int_the + cell_int_resto + cell_int_markets+ cell_int_coast + cell_int_hos + cell_int_parks + cell_int_u +cell_int_sch + cell_int_wat); suitability = house_match_perc; feature.set("accessibility", accessibility); feature.set("livability", livability); feature.set("suitability", suitability); }); features_30km.forEach(function(feature ){ var grid30_id = feature.get("id"); // MATCH PERCENTAGE FOR UNIVERSITIES // When user input doesn't match cell range if ((feature.get("_univers_1")/1000) > parseInt(sliderUni.value)) { uni_matchmax = 0; uni_matchmin = 0; } else if (parseInt(sliderUni.value) == (feature.get("_univers_1")/1000)) { uni_matchmax = 0; uni_matchmin = 0; } // Getting the maximum matching distance value else if ((feature.get("_univers_2")/1000) == parseInt(sliderUni.value)) { uni_matchmax = (feature.get("_univers_2")/1000); } else if ((feature.get("_univers_2")/1000) > parseInt(sliderUni.value)) { uni_matchmax = parseInt(sliderUni.value); } else if ((feature.get("_univers_2")/1000) < parseInt(sliderUni.value)) { uni_matchmax = (feature.get("_univers_2")/1000); } // Getting the minimum matching distance value else if ((feature.get("_univers_1")/1000) == 0) { uni_matchmin = 0; } else if ((feature.get("_univers_1") /1000 > 0)) { uni_matchmin = (feature.get("_univers_1")/1000); } // MATCH PERCENTAGE FOR SCHOOLS // When user input doesn 't match cell range if ((feature.get("_schoolsmi")/1000) > parseInt(sliderSchools.value)) { sch_matchmax = 0; sch_matchmin = 0; } else if (parseInt(sliderSchools.value) == (feature.get("_schoolsmi")/1000)) { sch_matchmax = 0; sch_matchmin = 0; } // Getting the maximum matching distance value else if ((feature.get("_schoolsma")/1000) == parseInt(sliderSchools.value)) { sch_matchmax = (feature.get("_schoolsma")/1000); } else if ((feature.get("_schoolsma")/1000) > parseInt(sliderSchools.value)) { sch_matchmax = parseInt(sliderSchools.value); } else if ((feature.get("_schoolsma")/1000) < parseInt(sliderSchools.value)) { sch_matchmax = (feature.get("_schoolsma")/1000); } // Getting the minimum matching distance value else if ((feature.get("_schoolsmi")/1000) == 0) { sch_matchmin = 0; } else if ((feature.get("_schoolsmi")/1000 > 0)) { sch_matchmin = (feature.get("_schoolsmi")/1000); } // MATCH PERCENTAGE FOR COASTLINE // When user input doesn 't match cell range if ((feature.get("_coastli_1")/1000) > parseInt(sliderCoasts.value)) { coast_matchmax = 0; coast_matchmin = 0; } else if (parseInt(sliderCoasts.value) == (feature.get("_coastli_1")/1000)) { coast_matchmax = 0; coast_matchmin = 0; } // Getting the maximum matching distance value else if ((feature.get("_coastli_2")/1000) == parseInt(sliderCoasts.value)) { coast_matchmax = (feature.get("_coastli_2")/1000); } else if ((feature.get("_coastli_2")/1000) > parseInt(sliderSchools.value)) { coast_matchmax = parseInt(sliderCoasts.value); } else if ((feature.get("_coastli_2")/1000) < parseInt(sliderCoasts.value)) { coast_matchmax = (feature.get("_coastli_2")/1000); } // Getting the minimum matching distance value else if ((feature.get("_coastli_1")/1000) == 0) { coast_matchmin = 0; } else if ((feature.get("_coastli_1")/1000 > 0)) { coast_matchmin = (feature.get("_coastli_1")/1000); } // MATCH PERCENTAGE FOR HOSPITALS // When user input doesn 't match cell range if ((feature.get("_hospita_1")/1000) > parseInt(sliderHospitals.value)) { hos_matchmax = 0; hos_matchmin = 0; } else if (parseInt(sliderHospitals.value) == (feature.get("_hospita_1")/1000)) { hos_matchmax = 0; hos_matchmin = 0; } // Getting the maximum matching distance value else if ((feature.get("_hospita_2")/1000) == parseInt(sliderHospitals.value)) { hos_matchmax = (feature.get("_hospita_2")/1000); } else if ((feature.get("_hospita_2")/1000) > parseInt(sliderHospitals.value)) { hos_matchmax = parseInt(sliderHospitals.value); } else if ((feature.get("_hospita_2")/1000) < parseInt(sliderHospitals.value)) { hos_matchmax = (feature.get("_hospita_2")/1000); } // Getting the minimum matching distance value else if ((feature.get("_hospita_1")/1000) == 0) { hos_matchmin = 0; } else if ((feature.get("_hospita_1")/1000 > 0)) { hos_matchmin = (feature.get("_hospita_1")/1000); } // MATCH PERCENTAGE FOR LEISURE PARKS // When user input doesn 't match cell range if ((feature.get("_leisure_1")/1000) > parseInt(sliderParks.value)) { parks_matchmax = 0; parks_matchmin = 0; } else if (parseInt(sliderParks.value) == (feature.get("_leisure_1") /1000)) { parks_matchmax = 0; parks_matchmin = 0; } // Getting the maximum matching distance value else if ((feature.get("_leisure_2")/1000) == parseInt(sliderParks.value)) { parks_matchmax = (feature.get("_leisure_2")/1000); } else if ((feature.get("_leisure_2")/1000) > parseInt(sliderParks.value)) { parks_matchmax = parseInt(sliderParks.value); } else if ((feature.get("_leisure_2")/1000) < parseInt(sliderParks.value)) { parks_matchmax = (feature.get("_leisure_2")/1000); } // Getting the minimum matching distance value else if ((feature.get("_leisure_1")/1000) == 0) { parks_matchmin = 0; } else if ((feature.get("_leisure_1")/1000 > 0)) { parks_matchmin = (feature.get("_leisure_1")/1000); } // MATCH PERCENTAGE FOR ROADS // When user input doesn 't match cell range if ((feature.get("_roadsmin")/1000) > parseInt(sliderRoads.value)) { roads_matchmax = 0; roads_matchmin = 0; } else if (parseInt(sliderRoads.value) == (feature.get("_roadsmin")/1000)) { roads_matchmax = 0; roads_matchmin = 0; } // Getting the maximum matching distance value else if ((feature.get("_roadsmax")/1000) == parseInt(sliderRoads.value)) { roads_matchmax = (feature.get("_roadsmax")/1000); } else if ((feature.get("_roadsmax")/1000) > parseInt(sliderRoads.value)) { roads_matchmax = parseInt(sliderRoads.value); } else if ((feature.get("_roadsmax")/1000) < parseInt(sliderRoads.value)) { roads_matchmax = (feature.get("_roadsmax")/1000); } // Getting the minimum matching distance value else if ((feature.get("_roadsmin")/1000) == 0) { roads_matchmin = 0; } else if ((feature.get("_roadsmin")/1000 > 0)) { roads_matchmin = (feature.get("_roadsmin")/1000); } // MATCH PERCENTAGE FOR SUPERMARKETS // When user input doesn 't match cell range if ((feature.get("_superma_1")/1000) > parseInt(sliderMarkets.value)) { markets_matchmax = 0; markets_matchmin = 0; } else if (parseInt(sliderMarkets.value) == (feature.get("_superma_1")/1000)) { markets_matchmax = 0; markets_matchmin = 0; } // Getting the maximum matching distance value else if ((feature.get("_superma_2")/1000) == parseInt(sliderMarkets.value)) { markets_matchmax = (feature.get("_superma_2")/1000); } else if ((feature.get("_superma_2")/1000) > parseInt(sliderMarkets.value)) { markets_matchmax = parseInt(sliderMarkets.value); } else if ((feature.get("_superma_2")/1000) < parseInt(sliderMarkets.value)) { markets_matchmax = (feature.get("_superma_2")/1000); } // Getting the minimum matching distance value else if ((feature.get("_superma_1")/1000) == 0) { markets_matchmin = 0; } else if ((feature.get("_superma_1")/1000 > 0)) { markets_matchmin = (feature.get("_superma_1")/1000); } // MATCH PERCENTAGE FOR PUBLIC TRANSPORT STOPS // When user input doesn't match cell range if ((feature.get("_pt_stop_1")/1000) > parseInt(sliderPstops.value)) { ptst_matchmax = 0; ptst_matchmin = 0; } else if (parseInt(sliderPstops.value) == (feature.get("_pt_stop_1")/1000)) { ptst_matchmax = 0; ptst_matchmin = 0; } // Getting the maximum matching distance value else if ((feature.get("_pt_stop_2")/1000) == parseInt(sliderPstops.value)) { ptst_matchmax = (feature.get("_pt_stop_2")/1000); } else if (( feature.get("_pt_stop_2")/1000) > parseInt(sliderPstops.value)) { ptst_matchmax = parseInt(sliderPstops.value); } else if ((feature.get("_pt_stop_2")/1000) < parseInt(sliderPstops.value)) { ptst_matchmax = (feature.get("_pt_stop_2")/1000); } // Getting the minimum matching distance value else if ((feature.get("_pt_stop_1")/1000) == 0) { ptst_matchmin = 0; } else if ((feature.get("_pt_stop_1") /1000 > 0)) { ptst_matchmin = (feature.get("_pt_stop_1")/1000); } // MATCH PERCENTAGE FOR PUBLIC TRANSPORT STATIONS // When user input doesn't match cell range if ((feature.get("_pt_stat_1")/1000) > parseInt(sliderPstations.value)) { ptsta_matchmax = 0; ptsta_matchmin = 0; } else if (parseInt(sliderPstations.value) == (feature.get("_pt_stat_1")/1000)) { ptsta_matchmax = 0; ptsta_matchmin = 0; } // Getting the maximum matching distance value else if ((feature.get("_pt_stat_2")/1000) == parseInt(sliderPstations.value)) { ptsta_matchmax = (feature.get("_pt_stat_2")/1000); } else if (( feature.get("_pt_stat_2")/1000) > parseInt(sliderPstations.value)) { ptsta_matchmax = parseInt(sliderPstations.value); } else if ((feature.get("_pt_stations_2")/1000) < parseInt(sliderPstations.value)) { ptsta_matchmax = (feature.get("_pt_stat_2")/1000); } // Getting the minimum matching distance value else if ((feature.get("_pt_stat_1")/1000) == 0) { ptsta_matchmin = 0; } else if ((feature.get("_pt_stat_1") /1000 > 0)) { ptsta_matchmin = (feature.get("_pt_stat_1")/1000); } // MATCH PERCENTAGE FOR RESTAURANTS // When user input doesn 't match cell range if ((feature.get("_restaur_1")/1000) > parseInt(sliderRestuarants.value)) { resto_matchmax = 0; resto_matchmin = 0; } else if (parseInt(sliderRestuarants.value) == (feature.get("_restaur_1")/1000)) { resto_matchmax = 0; resto_matchmin = 0; } // Getting the maximum matching distance value else if ((feature.get("_restaur_2")/1000) == parseInt(sliderRestuarants.value)) { resto_matchmax = (feature.get("_restaur_2")/1000); } else if ((feature.get("_restaur_2")/1000) > parseInt(sliderRestuarants.value)) { resto_matchmax = parseInt(sliderRestuarants.value); } else if ((feature.get("_restaur_2")/1000) < parseInt(sliderRestuarants.value)) { resto_matchmax = (feature.get("_restaur_2")/1000); } // Getting the minimum matching distance value else if ((feature.get("_restaur_1")/1000) == 0) { resto_matchmin = 0; } else if ((feature.get("_restaur_1")/1000 > 0)) { resto_matchmin = (feature.get("_restaur_1")/1000); } // MATCH PERCENTAGE FOR THEATRES // When user input doesn 't match cell range if ((feature.get("_theatre_1")/1000) > parseInt(sliderTheatres.value)) { the_matchmax = 0; the_matchmin = 0; } else if (parseInt(sliderTheatres.value) == (feature.get("_theatre_1")/1000)) { the_matchmax = 0; the_matchmin = 0; } // Getting the maximum matching distance value else if ((feature.get("_theatre_2")/1000) == parseInt(sliderTheatres.value)) { the_matchmax = (feature.get("_theatre_2")/1000); } else if ((feature.get("_theatre_2")/1000) > parseInt(sliderTheatres.value)) { the_matchmax = parseInt(sliderTheatres.value); } else if ((feature.get("_theatre_2")/1000) < parseInt(sliderTheatres.value)) { the_matchmax = (feature.get("_theatre_2")/1000); } // Getting the minimum matching distance value else if ((feature.get("_theatre_1")/1000) == 0) { the_matchmin = 0; } else if ((feature.get("_theatre_1")/1000 > 0)) { the_matchmin = (feature.get("_theatre_1")/1000); } // MATCH PERCENTAGE FOR CINEMAS // When user input doesn 't match cell range if ((feature.get("_cinemasmi")/1000) > parseInt(sliderCinemas.value)) { cin_matchmax = 0; cin_matchmin = 0; } else if (parseInt(sliderCinemas.value) == (feature.get("_cinemasmi")/1000)) { cin_matchmax = 0; cin_matchmin = 0; } // Getting the maximum matching distance value else if ((feature.get("_cinemasma")/1000) == parseInt(sliderCinemas.value)) { cin_matchmax = (feature.get("_cinemasma")/1000); } else if ((feature.get("_cinemasma")/1000) > parseInt(sliderCinemas.value)) { cin_matchmax = parseInt(sliderCinemas.value); } else if ((feature.get("_cinemasma")/1000) < parseInt(sliderCinemas.value)) { cin_matchmax = (feature.get("_cinemasma")/1000); } // Getting the minimum matching distance value else if ((feature.get("_cinemasmi")/1000) == 0) { cin_matchmin = 0; } else if ((feature.get("_cinemasmi")/1000 > 0)) { cin_matchmin = (feature.get("_cinemasmi")/1000); } // MATCH PERCENTAGE FOR KINDERGARTENS // When user input doesn 't match cell range if ((feature.get("_kindermin")/1000) > parseInt(sliderKinder.value)) { kin_matchmax = 0; kin_matchmin = 0; } else if (parseInt(sliderKinder.value) == (feature.get("_kindermin")/1000)) { kin_matchmax = 0; kin_matchmin = 0; } // Getting the maximum matching distance value else if ((feature.get("_kindermax")/1000) == parseInt(sliderKinder.value)) { kin_matchmax = (feature.get("_kindermax")/1000); } else if ((feature.get("_kindermax")/1000) > parseInt(sliderKinder.value)) { kin_matchmax = parseInt(sliderKinder.value); } else if ((feature.get("_kindermax")/1000) < parseInt(sliderKinder.value)) { kin_matchmax = (feature.get("_kindermax")/1000); } // Getting the minimum matching distance value else if ((feature.get("_kindermin")/1000) == 0) { kin_matchmin = 0; } else if ((feature.get("_kindermin")/1000 > 0)) { kin_matchmin = (feature.get("_kindermin")/1000); } // MATCH PERCENTAGE FOR INDUSTRIES // When user input doesn 't match cell range if ((feature.get("_industr_1")/1000) > parseInt(sliderIndustry.value)) { ind_matchmax = 0; ind_matchmin = 0; } else if (parseInt(sliderIndustry.value) == (feature.get("_industr_1")/1000)) { ind_matchmax = 0; ind_matchmin = 0; } // Getting the maximum matching distance value else if ((feature.get("_industr_2")/1000) == parseInt(sliderIndustry.value)) { } else if ((feature.get("_industr_2")/1000) > parseInt(sliderIndustry.value)) { ind_matchmax = parseInt(sliderIndustry.value); } else if ((feature.get("_industr_2")/1000) < parseInt(sliderIndustry.value)) { ind_matchmax = (feature.get("_industr_2")/1000); } // Getting the minimum matching distance value else if ((feature.get("_industr_1")/1000) == 0) { ind_matchmin = 0; } else if ((feature.get("_industr_1")/1000 > 0)) { ind_matchmin = (feature.get("_industr_1")/1000); } // MATCH PERCENTAGE FOR WATER BODIES // When user input doesn 't match cell range if ((feature.get("_waterbo_1")) > parseInt(sliderWater.value)) { wat_matchmax = 0; wat_matchmin = 0; } else if (parseInt(sliderWater.value) == (feature.get("_waterbo_1"))) { wat_matchmax = 0; wat_matchmin = 0; } // Getting the maximum matching distance value else if ((feature.get("_waterbo_2")) == parseInt(sliderWater.value)) { wat_matchmax = (feature.get("_waterbo_2")); } else if ((feature.get("_waterbo_2")) > parseInt(sliderWater.value)) { wat_matchmax = parseInt(sliderWater.value); } else if ((feature.get("_waterbo_2")) < parseInt(sliderWater.value)) { wat_matchmax = (feature.get("_waterbo_2")); } // Getting the minimum matching distance value else if ((feature.get("_waterbo_1")) == 0) { wat_matchmin = 0; } else if ((feature.get("_waterbo_1")) > 0){ wat_matchmin = (feature.get("_waterbo_1")); } // MATCH PERCENTAGE FOR HOUSE PRICES if ((feature.get("housepri_2")) > parseInt(sliderHprice.value)) { house_match_perc = 0; //Out of the cell interval } else {(((feature.get("housepri_2") == parseInt(sliderHprice.value)) || (parseInt(sliderHprice.value) > (feature.get("housepri_2"))))) house_match_perc = 100; //Within the cell interval } //UNIVERSITIES matching percentage uni_matchdiff = (uni_matchmax - uni_matchmin); cell_int_u = (feature.get("_univers_2")/1000) - (feature.get("_univers_1")/1000); // Getting the match percentage uni_match_perc = (uni_matchdiff * 100) / cell_int_u; //SCHOOLS matching percentage sch_matchdiff = (sch_matchmax - sch_matchmin); cell_int_sch = (feature.get("_schoolsma")/1000) - (feature.get("_schoolsmi")/1000); // Getting the match percentage sch_match_perc = (sch_matchdiff * 100) / cell_int_sch; //COASTLINE matching percentage coast_matchdiff = (coast_matchmax - coast_matchmin); cell_int_coast = (feature.get("_coastli_2")/1000) - (feature.get("_coastli_1")/1000); // Getting the match percentage coast_match_perc = (coast_matchdiff * 100) / cell_int_coast; //HOSPITALS matching percentage hos_matchdiff = (hos_matchmax - hos_matchmin); cell_int_hos = (feature.get("_hospita_2")/1000) - (feature.get("_hospita_1")/1000); // Getting the match percentage hos_match_perc = (hos_matchdiff * 100) / cell_int_hos; //PARKS matching percentage parks_matchdiff = (parks_matchmax - parks_matchmin); cell_int_parks = (feature.get("_leisure_2")/1000) - (feature.get("_leisure_1")/1000); // Getting the match percentage parks_match_perc = (parks_matchdiff * 100) / cell_int_parks; // ROADS matching percentage roads_matchdiff = (roads_matchmax - roads_matchmin); cell_int_roads = (feature.get("_roadsmax")/1000) - (feature.get("_roadsmin")/1000); // Getting the match percentage roads_match_perc = (roads_matchdiff * 100) / cell_int_roads; // SUPERMARKETS matching percentage markets_matchdiff = (markets_matchmax - markets_matchmin); cell_int_markets = (feature.get("_superma_2")/1000) - (feature.get("_superma_1")/1000); // Getting the match percentage markets_match_perc = (markets_matchdiff * 100) / cell_int_markets; // PUBLIC TRANSPORT STOPS matching percentage ptst_matchdiff = (ptst_matchmax - ptst_matchmin); cell_int_ptst = (feature.get("_pt_stop_2")/1000) - (feature.get("_pt_stop_1")/1000); // Getting the match percentage ptst_match_perc = (ptst_matchdiff * 100) / cell_int_ptst; // PUBLIC TRANSPORT STATIONS matching percentage ptsta_matchdiff = (ptsta_matchmax - ptsta_matchmin); cell_int_ptsta = (feature.get("_pt_stat_2")/1000) - (feature.get("_pt_stat_1")/1000); // Getting the match percentage ptsta_match_perc = (ptsta_matchdiff * 100) / cell_int_ptsta; // RESTAURANTS matching percentage resto_matchdiff = (resto_matchmax - resto_matchmin); cell_int_resto = (feature.get("_restaur_2")/1000) - (feature.get("_restaur_1")/1000); // Getting the match percentage resto_match_perc = (resto_matchdiff * 100) / cell_int_resto; // THEATRES matching percentage the_matchdiff = (the_matchmax - the_matchmin); cell_int_the = (feature.get("_theatre_2")/1000) - (feature.get("_theatre_1")/1000); // Getting the match percentage the_match_perc = (the_matchdiff * 100) / cell_int_the; // CINEMAS matching percentage cin_matchdiff = (cin_matchmax - cin_matchmin); cell_int_cin = (feature.get("_cinemasma")/1000) - (feature.get("_cinemasmi")/1000); // Getting the match percentage cin_match_perc = ( cin_matchdiff * 100) / cell_int_cin; // KINDERGARTENS matching percentage kin_matchdiff = (kin_matchmax - kin_matchmin); cell_int_kin = (feature.get("_kindermax")/1000) - (feature.get("_kindermin")/1000); // Getting the match percentage kin_match_perc = (kin_matchdiff * 100) / cell_int_kin; // INDUSTRIES matching percentage ind_matchdiff = (ind_matchmax - ind_matchmin); cell_int_ind = (feature.get("_industr_2")/1000) - (feature.get("_industr_1")/1000); // Getting the match percentage ind_match_perc = (ind_matchdiff * 100) / cell_int_ind; // WATER BODIES matching percentage wat_matchdiff = (wat_matchmax - wat_matchmin); cell_int_wat = (feature.get("_waterbo_2")/1000) - (feature.get("_waterbo_1")/1000); // Getting the match percentage wat_match_perc = (wat_matchdiff * 100) / cell_int_wat; // OVERALL PERCENTAGE CELL MATCH var new_fuzzy_value_30km = (ind_matchdiff + kin_matchdiff + cin_matchdiff + the_matchdiff + ptsta_matchdiff + ptst_matchdiff + resto_matchdiff + markets_matchdiff + roads_matchdiff + parks_matchdiff + uni_matchdiff + sch_matchdiff + coast_matchdiff + hos_matchdiff + wat_matchdiff)/ (cell_int_ind + cell_int_kin + cell_int_cin + cell_int_the + cell_int_resto + cell_int_ptsta + cell_int_ptst + cell_int_markets + cell_int_coast + cell_int_hos + cell_int_parks + cell_int_u + cell_int_sch + cell_int_roads + cell_int_wat); feature.set("fuzzyvalue", new_fuzzy_value_30km); console.log("Cell " + grid30_id + " Fuzzy Value: " + new_fuzzy_value_30km); accessibility = (((roads_matchdiff + ptsta_matchdiff + ptst_matchdiff)*100 / (cell_int_ptsta + cell_int_ptst + cell_int_roads))); livability = ((ind_matchdiff + kin_matchdiff + cin_matchdiff + the_matchdiff + resto_matchdiff + markets_matchdiff + parks_matchdiff + uni_matchdiff + sch_matchdiff + coast_matchdiff + hos_matchdiff + wat_matchdiff) * 100) / (cell_int_ind + cell_int_kin + cell_int_cin + cell_int_the + cell_int_resto + cell_int_markets+ cell_int_coast + cell_int_hos + cell_int_parks + cell_int_u +cell_int_sch + cell_int_wat); suitability = house_match_perc; feature.set("accessibility", accessibility); feature.set("livability", livability); feature.set("suitability", suitability); }); features_1km_fyn.forEach(function(feature ){ // MATCH PERCENTAGE FOR UNIVERSITIES // When user input doesn't match cell range if ((feature.get("_univers_1")/1000) > parseInt(sliderUni.value)) { uni_matchmax = 0; uni_matchmin = 0; } else if (parseInt(sliderUni.value) == (feature.get("_univers_1")/1000)) { uni_matchmax = 0; uni_matchmin = 0; } // Getting the maximum matching distance value else if ((feature.get("_univers_2")/1000) == parseInt(sliderUni.value)) { uni_matchmax = (feature.get("_univers_2")/1000); } else if ((feature.get("_univers_2")/1000) > parseInt(sliderUni.value)) { uni_matchmax = parseInt(sliderUni.value); } else if ((feature.get("_univers_2")/1000) < parseInt(sliderUni.value)) { uni_matchmax = (feature.get("_univers_2")/1000); } // Getting the minimum matching distance value else if ((feature.get("_univers_1")/1000) == 0) { uni_matchmin = 0; } else if ((feature.get("_univers_1") /1000 > 0)) { uni_matchmin = (feature.get("_univers_1")/1000); } // MATCH PERCENTAGE FOR SCHOOLS // When user input doesn 't match cell range if ((feature.get("_schoolsmi")/1000) > parseInt(sliderSchools.value)) { sch_matchmax = 0; sch_matchmin = 0; } else if (parseInt(sliderSchools.value) == (feature.get("_schoolsmi")/1000)) { sch_matchmax = 0; sch_matchmin = 0; } // Getting the maximum matching distance value else if ((feature.get("_schoolsma")/1000) == parseInt(sliderSchools.value)) { sch_matchmax = (feature.get("_schoolsma")/1000); } else if ((feature.get("_schoolsma")/1000) > parseInt(sliderSchools.value)) { sch_matchmax = parseInt(sliderSchools.value); } else if ((feature.get("_schoolsma")/1000) < parseInt(sliderSchools.value)) { sch_matchmax = (feature.get("_schoolsma")/1000); } // Getting the minimum matching distance value else if ((feature.get("_schoolsmi")/1000) == 0) { sch_matchmin = 0; } else if ((feature.get("_schoolsmi")/1000 > 0)) { sch_matchmin = (feature.get("_schoolsmi")/1000); } // MATCH PERCENTAGE FOR COASTLINE // When user input doesn 't match cell range if ((feature.get("_coastli_1")/1000) > parseInt(sliderCoasts.value)) { coast_matchmax = 0; coast_matchmin = 0; } else if (parseInt(sliderCoasts.value) == (feature.get("_coastli_1")/1000)) { coast_matchmax = 0; coast_matchmin = 0; } // Getting the maximum matching distance value else if ((feature.get("_coastli_2")/1000) == parseInt(sliderCoasts.value)) { coast_matchmax = (feature.get("_coastli_2")/1000); } else if ((feature.get("_coastli_2")/1000) > parseInt(sliderSchools.value)) { coast_matchmax = parseInt(sliderCoasts.value); } else if ((feature.get("_coastli_2")/1000) < parseInt(sliderCoasts.value)) { coast_matchmax = (feature.get("_coastli_2")/1000); } // Getting the minimum matching distance value else if ((feature.get("_coastli_1")/1000) == 0) { coast_matchmin = 0; } else if ((feature.get("_coastli_1")/1000 > 0)) { coast_matchmin = (feature.get("_coastli_1")/1000); } // MATCH PERCENTAGE FOR HOSPITALS // When user input doesn 't match cell range if ((feature.get("_hospita_1")/1000) > parseInt(sliderHospitals.value)) { hos_matchmax = 0; hos_matchmin = 0; } else if (parseInt(sliderHospitals.value) == (feature.get("_hospita_1")/1000)) { hos_matchmax = 0; hos_matchmin = 0; } // Getting the maximum matching distance value else if ((feature.get("_hospita_2")/1000) == parseInt(sliderHospitals.value)) { hos_matchmax = (feature.get("_hospita_2")/1000); } else if ((feature.get("_hospita_2")/1000) > parseInt(sliderHospitals.value)) { hos_matchmax = parseInt(sliderHospitals.value); } else if ((feature.get("_hospita_2")/1000) < parseInt(sliderHospitals.value)) { hos_matchmax = (feature.get("_hospita_2")/1000); } // Getting the minimum matching distance value else if ((feature.get("_hospita_1")/1000) == 0) { hos_matchmin = 0; } else if ((feature.get("_hospita_1")/1000 > 0)) { hos_matchmin = (feature.get("_hospita_1")/1000); } // MATCH PERCENTAGE FOR LEISURE PARKS // When user input doesn 't match cell range if ((feature.get("_leisure_1")/1000) > parseInt(sliderParks.value)) { parks_matchmax = 0; parks_matchmin = 0; } else if (parseInt(sliderParks.value) == (feature.get("_leisure_1") /1000)) { parks_matchmax = 0; parks_matchmin = 0; } // Getting the maximum matching distance value else if ((feature.get("_leisure_2")/1000) == parseInt(sliderParks.value)) { parks_matchmax = (feature.get("_leisure_2")/1000); } else if ((feature.get("_leisure_2")/1000) > parseInt(sliderParks.value)) { parks_matchmax = parseInt(sliderParks.value); } else if ((feature.get("_leisure_2")/1000) < parseInt(sliderParks.value)) { parks_matchmax = (feature.get("_leisure_2")/1000); } // Getting the minimum matching distance value else if ((feature.get("_leisure_1")/1000) == 0) { parks_matchmin = 0; } else if ((feature.get("_leisure_1")/1000 > 0)) { parks_matchmin = (feature.get("_leisure_1")/1000); } // MATCH PERCENTAGE FOR ROADS // When user input doesn 't match cell range if ((feature.get("_roadsmin")/1000) > parseInt(sliderRoads.value)) { roads_matchmax = 0; roads_matchmin = 0; } else if (parseInt(sliderRoads.value) == (feature.get("_roadsmin")/1000)) { roads_matchmax = 0; roads_matchmin = 0; } // Getting the maximum matching distance value else if ((feature.get("_roadsmax")/1000) == parseInt(sliderRoads.value)) { roads_matchmax = (feature.get("_roadsmax")/1000); } else if ((feature.get("_roadsmax")/1000) > parseInt(sliderRoads.value)) { roads_matchmax = parseInt(sliderRoads.value); } else if ((feature.get("_roadsmax")/1000) < parseInt(sliderRoads.value)) { roads_matchmax = (feature.get("_roadsmax")/1000); } // Getting the minimum matching distance value else if ((feature.get("_roadsmin")/1000) == 0) { roads_matchmin = 0; } else if ((feature.get("_roadsmin")/1000 > 0)) { roads_matchmin = (feature.get("_roadsmin")/1000); } // MATCH PERCENTAGE FOR SUPERMARKETS // When user input doesn 't match cell range if ((feature.get("_superma_1")/1000) > parseInt(sliderMarkets.value)) { markets_matchmax = 0; markets_matchmin = 0; } else if (parseInt(sliderMarkets.value) == (feature.get("_superma_1")/1000)) { markets_matchmax = 0; markets_matchmin = 0; } // Getting the maximum matching distance value else if ((feature.get("_superma_2")/1000) == parseInt(sliderMarkets.value)) { markets_matchmax = (feature.get("_superma_2")/1000); } else if ((feature.get("_superma_2")/1000) > parseInt(sliderMarkets.value)) { markets_matchmax = parseInt(sliderMarkets.value); } else if ((feature.get("_superma_2")/1000) < parseInt(sliderMarkets.value)) { markets_matchmax = (feature.get("_superma_2")/1000); } // Getting the minimum matching distance value else if ((feature.get("_superma_1")/1000) == 0) { markets_matchmin = 0; } else if ((feature.get("_superma_1")/1000 > 0)) { markets_matchmin = (feature.get("_superma_1")/1000); } // MATCH PERCENTAGE FOR PUBLIC TRANSPORT STOPS // When user input doesn't match cell range if ((feature.get("_pt_stop_1")/1000) > parseInt(sliderPstops.value)) { ptst_matchmax = 0; ptst_matchmin = 0; } else if (parseInt(sliderPstops.value) == (feature.get("_pt_stop_1")/1000)) { ptst_matchmax = 0; ptst_matchmin = 0; } // Getting the maximum matching distance value else if ((feature.get("_pt_stop_2")/1000) == parseInt(sliderPstops.value)) { ptst_matchmax = (feature.get("_pt_stop_2")/1000); } else if (( feature.get("_pt_stop_2")/1000) > parseInt(sliderPstops.value)) { ptst_matchmax = parseInt(sliderPstops.value); } else if ((feature.get("_pt_stop_2")/1000) < parseInt(sliderPstops.value)) { ptst_matchmax = (feature.get("_pt_stop_2")/1000); } // Getting the minimum matching distance value else if ((feature.get("_pt_stop_1")/1000) == 0) { ptst_matchmin = 0; } else if ((feature.get("_pt_stop_1") /1000 > 0)) { ptst_matchmin = (feature.get("_pt_stop_1")/1000); } // MATCH PERCENTAGE FOR PUBLIC TRANSPORT STATIONS // When user input doesn't match cell range if ((feature.get("_pt_stat_1")/1000) > parseInt(sliderPstations.value)) { ptsta_matchmax = 0; ptsta_matchmin = 0; } else if (parseInt(sliderPstations.value) == (feature.get("_pt_stat_1")/1000)) { ptsta_matchmax = 0; ptsta_matchmin = 0; } // Getting the maximum matching distance value else if ((feature.get("_pt_stat_2")/1000) == parseInt(sliderPstations.value)) { ptsta_matchmax = (feature.get("_pt_stat_2")/1000); } else if (( feature.get("_pt_stat_2")/1000) > parseInt(sliderPstations.value)) { ptsta_matchmax = parseInt(sliderPstations.value); } else if ((feature.get("_pt_stations_2")/1000) < parseInt(sliderPstations.value)) { ptsta_matchmax = (feature.get("_pt_stat_2")/1000); } // Getting the minimum matching distance value else if ((feature.get("_pt_stat_1")/1000) == 0) { ptsta_matchmin = 0; } else if ((feature.get("_pt_stat_1") /1000 > 0)) { ptsta_matchmin = (feature.get("_pt_stat_1")/1000); } // MATCH PERCENTAGE FOR RESTAURANTS // When user input doesn 't match cell range if ((feature.get("_restaur_1")/1000) > parseInt(sliderRestuarants.value)) { resto_matchmax = 0; resto_matchmin = 0; } else if (parseInt(sliderRestuarants.value) == (feature.get("_restaur_1")/1000)) { resto_matchmax = 0; resto_matchmin = 0; } // Getting the maximum matching distance value else if ((feature.get("_restaur_2")/1000) == parseInt(sliderRestuarants.value)) { resto_matchmax = (feature.get("_restaur_2")/1000); } else if ((feature.get("_restaur_2")/1000) > parseInt(sliderRestuarants.value)) { resto_matchmax = parseInt(sliderRestuarants.value); } else if ((feature.get("_restaur_2")/1000) < parseInt(sliderRestuarants.value)) { resto_matchmax = (feature.get("_restaur_2")/1000); } // Getting the minimum matching distance value else if ((feature.get("_restaur_1")/1000) == 0) { resto_matchmin = 0; } else if ((feature.get("_restaur_1")/1000 > 0)) { resto_matchmin = (feature.get("_restaur_1")/1000); } // MATCH PERCENTAGE FOR THEATRES // When user input doesn 't match cell range if ((feature.get("_theatre_1")/1000) > parseInt(sliderTheatres.value)) { the_matchmax = 0; the_matchmin = 0; } else if (parseInt(sliderTheatres.value) == (feature.get("_theatre_1")/1000)) { the_matchmax = 0; the_matchmin = 0; } // Getting the maximum matching distance value else if ((feature.get("_theatre_2")/1000) == parseInt(sliderTheatres.value)) { the_matchmax = (feature.get("_theatre_2")/1000); } else if ((feature.get("_theatre_2")/1000) > parseInt(sliderTheatres.value)) { the_matchmax = parseInt(sliderTheatres.value); } else if ((feature.get("_theatre_2")/1000) < parseInt(sliderTheatres.value)) { the_matchmax = (feature.get("_theatre_2")/1000); } // Getting the minimum matching distance value else if ((feature.get("_theatre_1")/1000) == 0) { the_matchmin = 0; } else if ((feature.get("_theatre_1")/1000 > 0)) { the_matchmin = (feature.get("_theatre_1")/1000); } // MATCH PERCENTAGE FOR CINEMAS // When user input doesn 't match cell range if ((feature.get("_cinemasmi")/1000) > parseInt(sliderCinemas.value)) { cin_matchmax = 0; cin_matchmin = 0; } else if (parseInt(sliderCinemas.value) == (feature.get("_cinemasmi")/1000)) { cin_matchmax = 0; cin_matchmin = 0; } // Getting the maximum matching distance value else if ((feature.get("_cinemasma")/1000) == parseInt(sliderCinemas.value)) { cin_matchmax = (feature.get("_cinemasma")/1000); } else if ((feature.get("_cinemasma")/1000) > parseInt(sliderCinemas.value)) { cin_matchmax = parseInt(sliderCinemas.value); } else if ((feature.get("_cinemasma")/1000) < parseInt(sliderCinemas.value)) { cin_matchmax = (feature.get("_cinemasma")/1000); } // Getting the minimum matching distance value else if ((feature.get("_cinemasmi")/1000) == 0) { cin_matchmin = 0; } else if ((feature.get("_cinemasmi")/1000 > 0)) { cin_matchmin = (feature.get("_cinemasmi")/1000); } // MATCH PERCENTAGE FOR KINDERGARTENS // When user input doesn 't match cell range if ((feature.get("_kindermin")/1000) > parseInt(sliderKinder.value)) { kin_matchmax = 0; kin_matchmin = 0; } else if (parseInt(sliderKinder.value) == (feature.get("_kindermin")/1000)) { kin_matchmax = 0; kin_matchmin = 0; } // Getting the maximum matching distance value else if ((feature.get("_kindermax")/1000) == parseInt(sliderKinder.value)) { kin_matchmax = (feature.get("_kindermax")/1000); } else if ((feature.get("_kindermax")/1000) > parseInt(sliderKinder.value)) { kin_matchmax = parseInt(sliderKinder.value); } else if ((feature.get("_kindermax")/1000) < parseInt(sliderKinder.value)) { kin_matchmax = (feature.get("_kindermax")/1000); } // Getting the minimum matching distance value else if ((feature.get("_kindermin")/1000) == 0) { kin_matchmin = 0; } else if ((feature.get("_kindermin")/1000 > 0)) { kin_matchmin = (feature.get("_kindermin")/1000); } // MATCH PERCENTAGE FOR INDUSTRIES // When user input doesn 't match cell range if ((feature.get("_industr_1")/1000) > parseInt(sliderIndustry.value)) { ind_matchmax = 0; ind_matchmin = 0; } else if (parseInt(sliderIndustry.value) == (feature.get("_industr_1")/1000)) { ind_matchmax = 0; ind_matchmin = 0; } // Getting the maximum matching distance value else if ((feature.get("_industr_2")/1000) == parseInt(sliderIndustry.value)) { } else if ((feature.get("_industr_2")/1000) > parseInt(sliderIndustry.value)) { ind_matchmax = parseInt(sliderIndustry.value); } else if ((feature.get("_industr_2")/1000) < parseInt(sliderIndustry.value)) { ind_matchmax = (feature.get("_industr_2")/1000); } // Getting the minimum matching distance value else if ((feature.get("_industr_1")/1000) == 0) { ind_matchmin = 0; } else if ((feature.get("_industr_1")/1000 > 0)) { ind_matchmin = (feature.get("_industr_1")/1000); } // MATCH PERCENTAGE FOR WATER BODIES // When user input doesn 't match cell range if ((feature.get("_waterbo_1")) > parseInt(sliderWater.value)) { wat_matchmax = 0; wat_matchmin = 0; } else if (parseInt(sliderWater.value) == (feature.get("_waterbo_1"))) { wat_matchmax = 0; wat_matchmin = 0; } // Getting the maximum matching distance value else if ((feature.get("_waterbo_2")) == parseInt(sliderWater.value)) { wat_matchmax = (feature.get("_waterbo_2")); } else if ((feature.get("_waterbo_2")) > parseInt(sliderWater.value)) { wat_matchmax = parseInt(sliderWater.value); } else if ((feature.get("_waterbo_2")) < parseInt(sliderWater.value)) { wat_matchmax = (feature.get("_waterbo_2")); } // Getting the minimum matching distance value else if ((feature.get("_waterbo_1")) == 0) { wat_matchmin = 0; } else if ((feature.get("_waterbo_1")) > 0){ wat_matchmin = (feature.get("_waterbo_1")); } // MATCH PERCENTAGE FOR HOUSE PRICES if ((feature.get("housepri_2")) > parseInt(sliderHprice.value)) { house_match_perc = 0; //Out of the cell interval } else {(((feature.get("housepri_2") == parseInt(sliderHprice.value)) || (parseInt(sliderHprice.value) > (feature.get("housepri_2"))))) house_match_perc = 100; //Within the cell interval } //UNIVERSITIES matching percentage uni_matchdiff = (uni_matchmax - uni_matchmin); cell_int_u = (feature.get("_univers_2")/1000) - (feature.get("_univers_1")/1000); // Getting the match percentage uni_match_perc = (uni_matchdiff * 100) / cell_int_u; //SCHOOLS matching percentage sch_matchdiff = (sch_matchmax - sch_matchmin); cell_int_sch = (feature.get("_schoolsma")/1000) - (feature.get("_schoolsmi")/1000); // Getting the match percentage sch_match_perc = (sch_matchdiff * 100) / cell_int_sch; //COASTLINE matching percentage coast_matchdiff = (coast_matchmax - coast_matchmin); cell_int_coast = (feature.get("_coastli_2")/1000) - (feature.get("_coastli_1")/1000); // Getting the match percentage coast_match_perc = (coast_matchdiff * 100) / cell_int_coast; //HOSPITALS matching percentage hos_matchdiff = (hos_matchmax - hos_matchmin); cell_int_hos = (feature.get("_hospita_2")/1000) - (feature.get("_hospita_1")/1000); // Getting the match percentage hos_match_perc = (hos_matchdiff * 100) / cell_int_hos; //PARKS matching percentage parks_matchdiff = (parks_matchmax - parks_matchmin); cell_int_parks = (feature.get("_leisure_2")/1000) - (feature.get("_leisure_1")/1000); // Getting the match percentage parks_match_perc = (parks_matchdiff * 100) / cell_int_parks; // ROADS matching percentage roads_matchdiff = (roads_matchmax - roads_matchmin); cell_int_roads = (feature.get("_roadsmax")/1000) - (feature.get("_roadsmin")/1000); // Getting the match percentage roads_match_perc = (roads_matchdiff * 100) / cell_int_roads; // SUPERMARKETS matching percentage markets_matchdiff = (markets_matchmax - markets_matchmin); cell_int_markets = (feature.get("_superma_2")/1000) - (feature.get("_superma_1")/1000); // Getting the match percentage markets_match_perc = (markets_matchdiff * 100) / cell_int_markets; // PUBLIC TRANSPORT STOPS matching percentage ptst_matchdiff = (ptst_matchmax - ptst_matchmin); cell_int_ptst = (feature.get("_pt_stop_2")/1000) - (feature.get("_pt_stop_1")/1000); // Getting the match percentage ptst_match_perc = (ptst_matchdiff * 100) / cell_int_ptst; // PUBLIC TRANSPORT STATIONS matching percentage ptsta_matchdiff = (ptsta_matchmax - ptsta_matchmin); cell_int_ptsta = (feature.get("_pt_stat_2")/1000) - (feature.get("_pt_stat_1")/1000); // Getting the match percentage ptsta_match_perc = (ptsta_matchdiff * 100) / cell_int_ptsta; // RESTAURANTS matching percentage resto_matchdiff = (resto_matchmax - resto_matchmin); cell_int_resto = (feature.get("_restaur_2")/1000) - (feature.get("_restaur_1")/1000); // Getting the match percentage resto_match_perc = (resto_matchdiff * 100) / cell_int_resto; // THEATRES matching percentage the_matchdiff = (the_matchmax - the_matchmin); cell_int_the = (feature.get("_theatre_2")/1000) - (feature.get("_theatre_1")/1000); // Getting the match percentage the_match_perc = (the_matchdiff * 100) / cell_int_the; // CINEMAS matching percentage cin_matchdiff = (cin_matchmax - cin_matchmin); cell_int_cin = (feature.get("_cinemasma")/1000) - (feature.get("_cinemasmi")/1000); // Getting the match percentage cin_match_perc = ( cin_matchdiff * 100) / cell_int_cin; // KINDERGARTENS matching percentage kin_matchdiff = (kin_matchmax - kin_matchmin); cell_int_kin = (feature.get("_kindermax")/1000) - (feature.get("_kindermin")/1000); // Getting the match percentage kin_match_perc = (kin_matchdiff * 100) / cell_int_kin; // INDUSTRIES matching percentage ind_matchdiff = (ind_matchmax - ind_matchmin); cell_int_ind = (feature.get("_industr_2")/1000) - (feature.get("_industr_1")/1000); // Getting the match percentage ind_match_perc = (ind_matchdiff * 100) / cell_int_ind; // WATER BODIES matching percentage wat_matchdiff = (wat_matchmax - wat_matchmin); cell_int_wat = (feature.get("_waterbo_2")/1000) - (feature.get("_waterbo_1")/1000); // Getting the match percentage wat_match_perc = (wat_matchdiff * 100) / cell_int_wat; // OVERALL PERCENTAGE CELL MATCH var new_fuzzy_value_1km_fyn = (ind_matchdiff + kin_matchdiff + cin_matchdiff + the_matchdiff + ptsta_matchdiff + ptst_matchdiff + resto_matchdiff + markets_matchdiff + roads_matchdiff + parks_matchdiff + uni_matchdiff + sch_matchdiff + coast_matchdiff + hos_matchdiff + wat_matchdiff)/ (cell_int_ind + cell_int_kin + cell_int_cin + cell_int_the + cell_int_resto + cell_int_ptsta + cell_int_ptst + cell_int_markets + cell_int_coast + cell_int_hos + cell_int_parks + cell_int_u + cell_int_sch + cell_int_roads + cell_int_wat); feature.set("fuzzyvalue", new_fuzzy_value_1km_fyn); accessibility = (((roads_matchdiff + ptsta_matchdiff + ptst_matchdiff)*100 / (cell_int_ptsta + cell_int_ptst + cell_int_roads))); livability = ((ind_matchdiff + kin_matchdiff + cin_matchdiff + the_matchdiff + resto_matchdiff + markets_matchdiff + parks_matchdiff + uni_matchdiff + sch_matchdiff + coast_matchdiff + hos_matchdiff + wat_matchdiff) * 100) / (cell_int_ind + cell_int_kin + cell_int_cin + cell_int_the + cell_int_resto + cell_int_markets+ cell_int_coast + cell_int_hos + cell_int_parks + cell_int_u +cell_int_sch + cell_int_wat); suitability = house_match_perc; feature.set("accessibility", accessibility); feature.set("livability", livability); feature.set("suitability", suitability); }); features_1km_hovestad.forEach(function(feature ){ // MATCH PERCENTAGE FOR UNIVERSITIES var new_uni var new_sch if ((feature.get("_univers_2")/1000) > parseInt(sliderUni.value)) { new_uni = 0; //Out of the cell interval console.log("error in new_uni= 0") } else if(((feature.get("_univers_2")/1000 == parseInt(sliderUni.value)) || (parseInt(sliderUni.value) > (feature.get("_univers_2"))))){ new_uni = 1; //Within the cell interval console.log("error in new_uni= 1") } // MATCH PERCENTAGE FOR SCHOOLS if ((feature.get("_schoolsma")/1000) > parseInt(sliderSchools.value)) { new_sch = 0; //Out of the cell interval console.log("error in new_sch= 0"); } else if(((feature.get("_schoolsma")/1000 == parseInt(sliderSchools.value)) || (parseInt(sliderSchools.value) > (feature.get("_schoolsma"))))){ new_sch = 1; //Within the cell interval console.log("error in new_sch= 1"); } // MATCH PERCENTAGE FOR HOUSE PRICES if ((feature.get("housepri_2")) > parseInt(sliderHprice.value)) { house_match_perc = 0; //Out of the cell interval } else if (((feature.get("housepri_2") == parseInt(sliderHprice.value)) || (parseInt(sliderHprice.value) > (feature.get("housepri_2"))))){ house_match_perc = 1; //Within the cell interval } // MATCH PERCENTAGE FOR KINDERGARTENS var new_kinder; if ((feature.get("_kindermax")/1000) > parseInt(sliderKinder.value)) { new_kinder = 0; //Out of the cell interval console.log("error in new_kinder = 0") } else if(((feature.get("_kindermax")/1000 == parseInt(sliderKinder.value)) || (parseInt(sliderKinder.value) > (feature.get("_kindermax"))))){ new_kinder = 1; //Within the cell interval console.log("error in new_kinder = 1") } // OVERALL PERCENTAGE CELL MATCH var new_fuzzy_value_1km_hovestad = ((new_uni + new_sch + house_match_perc + new_kinder)/4); feature.set("fuzzyvalue", new_fuzzy_value_1km_hovestad); console.log("1km Fuzzy: " + new_fuzzy_value_1km_hovestad); }); features_1km_midtjylland.forEach(function(feature ){ // MATCH PERCENTAGE FOR UNIVERSITIES // When user input doesn't match cell range if ((feature.get("_univers_1")/1000) > parseInt(sliderUni.value)) { uni_matchmax = 0; uni_matchmin = 0; } else if (parseInt(sliderUni.value) == (feature.get("_univers_1")/1000)) { uni_matchmax = 0; uni_matchmin = 0; } // Getting the maximum matching distance value else if ((feature.get("_univers_2")/1000) == parseInt(sliderUni.value)) { uni_matchmax = (feature.get("_univers_2")/1000); } else if ((feature.get("_univers_2")/1000) > parseInt(sliderUni.value)) { uni_matchmax = parseInt(sliderUni.value); } else if ((feature.get("_univers_2")/1000) < parseInt(sliderUni.value)) { uni_matchmax = (feature.get("_univers_2")/1000); } // Getting the minimum matching distance value else if ((feature.get("_univers_1")/1000) == 0) { uni_matchmin = 0; } else if ((feature.get("_univers_1") /1000 > 0)) { uni_matchmin = (feature.get("_univers_1")/1000); } // MATCH PERCENTAGE FOR SCHOOLS // When user input doesn 't match cell range if ((feature.get("_schoolsmi")/1000) > parseInt(sliderSchools.value)) { sch_matchmax = 0; sch_matchmin = 0; } else if (parseInt(sliderSchools.value) == (feature.get("_schoolsmi")/1000)) { sch_matchmax = 0; sch_matchmin = 0; } // Getting the maximum matching distance value else if ((feature.get("_schoolsma")/1000) == parseInt(sliderSchools.value)) { sch_matchmax = (feature.get("_schoolsma")/1000); } else if ((feature.get("_schoolsma")/1000) > parseInt(sliderSchools.value)) { sch_matchmax = parseInt(sliderSchools.value); } else if ((feature.get("_schoolsma")/1000) < parseInt(sliderSchools.value)) { sch_matchmax = (feature.get("_schoolsma")/1000); } // Getting the minimum matching distance value else if ((feature.get("_schoolsmi")/1000) == 0) { sch_matchmin = 0; } else if ((feature.get("_schoolsmi")/1000 > 0)) { sch_matchmin = (feature.get("_schoolsmi")/1000); } // MATCH PERCENTAGE FOR COASTLINE // When user input doesn 't match cell range if ((feature.get("_coastli_1")/1000) > parseInt(sliderCoasts.value)) { coast_matchmax = 0; coast_matchmin = 0; } else if (parseInt(sliderCoasts.value) == (feature.get("_coastli_1")/1000)) { coast_matchmax = 0; coast_matchmin = 0; } // Getting the maximum matching distance value else if ((feature.get("_coastli_2")/1000) == parseInt(sliderCoasts.value)) { coast_matchmax = (feature.get("_coastli_2")/1000); } else if ((feature.get("_coastli_2")/1000) > parseInt(sliderSchools.value)) { coast_matchmax = parseInt(sliderCoasts.value); } else if ((feature.get("_coastli_2")/1000) < parseInt(sliderCoasts.value)) { coast_matchmax = (feature.get("_coastli_2")/1000); } // Getting the minimum matching distance value else if ((feature.get("_coastli_1")/1000) == 0) { coast_matchmin = 0; } else if ((feature.get("_coastli_1")/1000 > 0)) { coast_matchmin = (feature.get("_coastli_1")/1000); } // MATCH PERCENTAGE FOR HOSPITALS // When user input doesn 't match cell range if ((feature.get("_hospita_1")/1000) > parseInt(sliderHospitals.value)) { hos_matchmax = 0; hos_matchmin = 0; } else if (parseInt(sliderHospitals.value) == (feature.get("_hospita_1")/1000)) { hos_matchmax = 0; hos_matchmin = 0; } // Getting the maximum matching distance value else if ((feature.get("_hospita_2")/1000) == parseInt(sliderHospitals.value)) { hos_matchmax = (feature.get("_hospita_2")/1000); } else if ((feature.get("_hospita_2")/1000) > parseInt(sliderHospitals.value)) { hos_matchmax = parseInt(sliderHospitals.value); } else if ((feature.get("_hospita_2")/1000) < parseInt(sliderHospitals.value)) { hos_matchmax = (feature.get("_hospita_2")/1000); } // Getting the minimum matching distance value else if ((feature.get("_hospita_1")/1000) == 0) { hos_matchmin = 0; } else if ((feature.get("_hospita_1")/1000 > 0)) { hos_matchmin = (feature.get("_hospita_1")/1000); } // MATCH PERCENTAGE FOR LEISURE PARKS // When user input doesn 't match cell range if ((feature.get("_leisure_1")/1000) > parseInt(sliderParks.value)) { parks_matchmax = 0; parks_matchmin = 0; } else if (parseInt(sliderParks.value) == (feature.get("_leisure_1") /1000)) { parks_matchmax = 0; parks_matchmin = 0; } // Getting the maximum matching distance value else if ((feature.get("_leisure_2")/1000) == parseInt(sliderParks.value)) { parks_matchmax = (feature.get("_leisure_2")/1000); } else if ((feature.get("_leisure_2")/1000) > parseInt(sliderParks.value)) { parks_matchmax = parseInt(sliderParks.value); } else if ((feature.get("_leisure_2")/1000) < parseInt(sliderParks.value)) { parks_matchmax = (feature.get("_leisure_2")/1000); } // Getting the minimum matching distance value else if ((feature.get("_leisure_1")/1000) == 0) { parks_matchmin = 0; } else if ((feature.get("_leisure_1")/1000 > 0)) { parks_matchmin = (feature.get("_leisure_1")/1000); } // MATCH PERCENTAGE FOR ROADS // When user input doesn 't match cell range if ((feature.get("_roadsmin")/1000) > parseInt(sliderRoads.value)) { roads_matchmax = 0; roads_matchmin = 0; } else if (parseInt(sliderRoads.value) == (feature.get("_roadsmin")/1000)) { roads_matchmax = 0; roads_matchmin = 0; } // Getting the maximum matching distance value else if ((feature.get("_roadsmax")/1000) == parseInt(sliderRoads.value)) { roads_matchmax = (feature.get("_roadsmax")/1000); } else if ((feature.get("_roadsmax")/1000) > parseInt(sliderRoads.value)) { roads_matchmax = parseInt(sliderRoads.value); } else if ((feature.get("_roadsmax")/1000) < parseInt(sliderRoads.value)) { roads_matchmax = (feature.get("_roadsmax")/1000); } // Getting the minimum matching distance value else if ((feature.get("_roadsmin")/1000) == 0) { roads_matchmin = 0; } else if ((feature.get("_roadsmin")/1000 > 0)) { roads_matchmin = (feature.get("_roadsmin")/1000); } // MATCH PERCENTAGE FOR SUPERMARKETS // When user input doesn 't match cell range if ((feature.get("_superma_1")/1000) > parseInt(sliderMarkets.value)) { markets_matchmax = 0; markets_matchmin = 0; } else if (parseInt(sliderMarkets.value) == (feature.get("_superma_1")/1000)) { markets_matchmax = 0; markets_matchmin = 0; } // Getting the maximum matching distance value else if ((feature.get("_superma_2")/1000) == parseInt(sliderMarkets.value)) { markets_matchmax = (feature.get("_superma_2")/1000); } else if ((feature.get("_superma_2")/1000) > parseInt(sliderMarkets.value)) { markets_matchmax = parseInt(sliderMarkets.value); } else if ((feature.get("_superma_2")/1000) < parseInt(sliderMarkets.value)) { markets_matchmax = (feature.get("_superma_2")/1000); } // Getting the minimum matching distance value else if ((feature.get("_superma_1")/1000) == 0) { markets_matchmin = 0; } else if ((feature.get("_superma_1")/1000 > 0)) { markets_matchmin = (feature.get("_superma_1")/1000); } // MATCH PERCENTAGE FOR PUBLIC TRANSPORT STOPS // When user input doesn't match cell range if ((feature.get("_pt_stop_1")/1000) > parseInt(sliderPstops.value)) { ptst_matchmax = 0; ptst_matchmin = 0; } else if (parseInt(sliderPstops.value) == (feature.get("_pt_stop_1")/1000)) { ptst_matchmax = 0; ptst_matchmin = 0; } // Getting the maximum matching distance value else if ((feature.get("_pt_stop_2")/1000) == parseInt(sliderPstops.value)) { ptst_matchmax = (feature.get("_pt_stop_2")/1000); } else if (( feature.get("_pt_stop_2")/1000) > parseInt(sliderPstops.value)) { ptst_matchmax = parseInt(sliderPstops.value); } else if ((feature.get("_pt_stop_2")/1000) < parseInt(sliderPstops.value)) { ptst_matchmax = (feature.get("_pt_stop_2")/1000); } // Getting the minimum matching distance value else if ((feature.get("_pt_stop_1")/1000) == 0) { ptst_matchmin = 0; } else if ((feature.get("_pt_stop_1") /1000 > 0)) { ptst_matchmin = (feature.get("_pt_stop_1")/1000); } // MATCH PERCENTAGE FOR PUBLIC TRANSPORT STATIONS // When user input doesn't match cell range if ((feature.get("_pt_stat_1")/1000) > parseInt(sliderPstations.value)) { ptsta_matchmax = 0; ptsta_matchmin = 0; } else if (parseInt(sliderPstations.value) == (feature.get("_pt_stat_1")/1000)) { ptsta_matchmax = 0; ptsta_matchmin = 0; } // Getting the maximum matching distance value else if ((feature.get("_pt_stat_2")/1000) == parseInt(sliderPstations.value)) { ptsta_matchmax = (feature.get("_pt_stat_2")/1000); } else if (( feature.get("_pt_stat_2")/1000) > parseInt(sliderPstations.value)) { ptsta_matchmax = parseInt(sliderPstations.value); } else if ((feature.get("_pt_stations_2")/1000) < parseInt(sliderPstations.value)) { ptsta_matchmax = (feature.get("_pt_stat_2")/1000); } // Getting the minimum matching distance value else if ((feature.get("_pt_stat_1")/1000) == 0) { ptsta_matchmin = 0; } else if ((feature.get("_pt_stat_1") /1000 > 0)) { ptsta_matchmin = (feature.get("_pt_stat_1")/1000); } // MATCH PERCENTAGE FOR RESTAURANTS // When user input doesn 't match cell range if ((feature.get("_restaur_1")/1000) > parseInt(sliderRestuarants.value)) { resto_matchmax = 0; resto_matchmin = 0; } else if (parseInt(sliderRestuarants.value) == (feature.get("_restaur_1")/1000)) { resto_matchmax = 0; resto_matchmin = 0; } // Getting the maximum matching distance value else if ((feature.get("_restaur_2")/1000) == parseInt(sliderRestuarants.value)) { resto_matchmax = (feature.get("_restaur_2")/1000); } else if ((feature.get("_restaur_2")/1000) > parseInt(sliderRestuarants.value)) { resto_matchmax = parseInt(sliderRestuarants.value); } else if ((feature.get("_restaur_2")/1000) < parseInt(sliderRestuarants.value)) { resto_matchmax = (feature.get("_restaur_2")/1000); } // Getting the minimum matching distance value else if ((feature.get("_restaur_1")/1000) == 0) { resto_matchmin = 0; } else if ((feature.get("_restaur_1")/1000 > 0)) { resto_matchmin = (feature.get("_restaur_1")/1000); } // MATCH PERCENTAGE FOR THEATRES // When user input doesn 't match cell range if ((feature.get("_theatre_1")/1000) > parseInt(sliderTheatres.value)) { the_matchmax = 0; the_matchmin = 0; } else if (parseInt(sliderTheatres.value) == (feature.get("_theatre_1")/1000)) { the_matchmax = 0; the_matchmin = 0; } // Getting the maximum matching distance value else if ((feature.get("_theatre_2")/1000) == parseInt(sliderTheatres.value)) { the_matchmax = (feature.get("_theatre_2")/1000); } else if ((feature.get("_theatre_2")/1000) > parseInt(sliderTheatres.value)) { the_matchmax = parseInt(sliderTheatres.value); } else if ((feature.get("_theatre_2")/1000) < parseInt(sliderTheatres.value)) { the_matchmax = (feature.get("_theatre_2")/1000); } // Getting the minimum matching distance value else if ((feature.get("_theatre_1")/1000) == 0) { the_matchmin = 0; } else if ((feature.get("_theatre_1")/1000 > 0)) { the_matchmin = (feature.get("_theatre_1")/1000); } // MATCH PERCENTAGE FOR CINEMAS // When user input doesn 't match cell range if ((feature.get("_cinemasmi")/1000) > parseInt(sliderCinemas.value)) { cin_matchmax = 0; cin_matchmin = 0; } else if (parseInt(sliderCinemas.value) == (feature.get("_cinemasmi")/1000)) { cin_matchmax = 0; cin_matchmin = 0; } // Getting the maximum matching distance value else if ((feature.get("_cinemasma")/1000) == parseInt(sliderCinemas.value)) { cin_matchmax = (feature.get("_cinemasma")/1000); } else if ((feature.get("_cinemasma")/1000) > parseInt(sliderCinemas.value)) { cin_matchmax = parseInt(sliderCinemas.value); } else if ((feature.get("_cinemasma")/1000) < parseInt(sliderCinemas.value)) { cin_matchmax = (feature.get("_cinemasma")/1000); } // Getting the minimum matching distance value else if ((feature.get("_cinemasmi")/1000) == 0) { cin_matchmin = 0; } else if ((feature.get("_cinemasmi")/1000 > 0)) { cin_matchmin = (feature.get("_cinemasmi")/1000); } // MATCH PERCENTAGE FOR KINDERGARTENS // When user input doesn 't match cell range if ((feature.get("_kindermin")/1000) > parseInt(sliderKinder.value)) { kin_matchmax = 0; kin_matchmin = 0; } else if (parseInt(sliderKinder.value) == (feature.get("_kindermin")/1000)) { kin_matchmax = 0; kin_matchmin = 0; } // Getting the maximum matching distance value else if ((feature.get("_kindermax")/1000) == parseInt(sliderKinder.value)) { kin_matchmax = (feature.get("_kindermax")/1000); } else if ((feature.get("_kindermax")/1000) > parseInt(sliderKinder.value)) { kin_matchmax = parseInt(sliderKinder.value); } else if ((feature.get("_kindermax")/1000) < parseInt(sliderKinder.value)) { kin_matchmax = (feature.get("_kindermax")/1000); } // Getting the minimum matching distance value else if ((feature.get("_kindermin")/1000) == 0) { kin_matchmin = 0; } else if ((feature.get("_kindermin")/1000 > 0)) { kin_matchmin = (feature.get("_kindermin")/1000); } // MATCH PERCENTAGE FOR INDUSTRIES // When user input doesn 't match cell range if ((feature.get("_industr_1")/1000) > parseInt(sliderIndustry.value)) { ind_matchmax = 0; ind_matchmin = 0; } else if (parseInt(sliderIndustry.value) == (feature.get("_industr_1")/1000)) { ind_matchmax = 0; ind_matchmin = 0; } // Getting the maximum matching distance value else if ((feature.get("_industr_2")/1000) == parseInt(sliderIndustry.value)) { } else if ((feature.get("_industr_2")/1000) > parseInt(sliderIndustry.value)) { ind_matchmax = parseInt(sliderIndustry.value); } else if ((feature.get("_industr_2")/1000) < parseInt(sliderIndustry.value)) { ind_matchmax = (feature.get("_industr_2")/1000); } // Getting the minimum matching distance value else if ((feature.get("_industr_1")/1000) == 0) { ind_matchmin = 0; } else if ((feature.get("_industr_1")/1000 > 0)) { ind_matchmin = (feature.get("_industr_1")/1000); } // MATCH PERCENTAGE FOR WATER BODIES // When user input doesn 't match cell range if ((feature.get("_waterbo_1")) > parseInt(sliderWater.value)) { wat_matchmax = 0; wat_matchmin = 0; } else if (parseInt(sliderWater.value) == (feature.get("_waterbo_1"))) { wat_matchmax = 0; wat_matchmin = 0; } // Getting the maximum matching distance value else if ((feature.get("_waterbo_2")) == parseInt(sliderWater.value)) { wat_matchmax = (feature.get("_waterbo_2")); } else if ((feature.get("_waterbo_2")) > parseInt(sliderWater.value)) { wat_matchmax = parseInt(sliderWater.value); } else if ((feature.get("_waterbo_2")) < parseInt(sliderWater.value)) { wat_matchmax = (feature.get("_waterbo_2")); } // Getting the minimum matching distance value else if ((feature.get("_waterbo_1")) == 0) { wat_matchmin = 0; } else if ((feature.get("_waterbo_1")) > 0){ wat_matchmin = (feature.get("_waterbo_1")); } // MATCH PERCENTAGE FOR HOUSE PRICES if ((feature.get("housepri_2")) > parseInt(sliderHprice.value)) { house_match_perc = 0; //Out of the cell interval } else {(((feature.get("housepri_2") == parseInt(sliderHprice.value)) || (parseInt(sliderHprice.value) > (feature.get("housepri_2"))))) house_match_perc = 100; //Within the cell interval } //UNIVERSITIES matching percentage uni_matchdiff = (uni_matchmax - uni_matchmin); cell_int_u = (feature.get("_univers_2")/1000) - (feature.get("_univers_1")/1000); // Getting the match percentage uni_match_perc = (uni_matchdiff * 100) / cell_int_u; //SCHOOLS matching percentage sch_matchdiff = (sch_matchmax - sch_matchmin); cell_int_sch = (feature.get("_schoolsma")/1000) - (feature.get("_schoolsmi")/1000); // Getting the match percentage sch_match_perc = (sch_matchdiff * 100) / cell_int_sch; //COASTLINE matching percentage coast_matchdiff = (coast_matchmax - coast_matchmin); cell_int_coast = (feature.get("_coastli_2")/1000) - (feature.get("_coastli_1")/1000); // Getting the match percentage coast_match_perc = (coast_matchdiff * 100) / cell_int_coast; //HOSPITALS matching percentage hos_matchdiff = (hos_matchmax - hos_matchmin); cell_int_hos = (feature.get("_hospita_2")/1000) - (feature.get("_hospita_1")/1000); // Getting the match percentage hos_match_perc = (hos_matchdiff * 100) / cell_int_hos; //PARKS matching percentage parks_matchdiff = (parks_matchmax - parks_matchmin); cell_int_parks = (feature.get("_leisure_2")/1000) - (feature.get("_leisure_1")/1000); // Getting the match percentage parks_match_perc = (parks_matchdiff * 100) / cell_int_parks; // ROADS matching percentage roads_matchdiff = (roads_matchmax - roads_matchmin); cell_int_roads = (feature.get("_roadsmax")/1000) - (feature.get("_roadsmin")/1000); // Getting the match percentage roads_match_perc = (roads_matchdiff * 100) / cell_int_roads; // SUPERMARKETS matching percentage markets_matchdiff = (markets_matchmax - markets_matchmin); cell_int_markets = (feature.get("_superma_2")/1000) - (feature.get("_superma_1")/1000); // Getting the match percentage markets_match_perc = (markets_matchdiff * 100) / cell_int_markets; // PUBLIC TRANSPORT STOPS matching percentage ptst_matchdiff = (ptst_matchmax - ptst_matchmin); cell_int_ptst = (feature.get("_pt_stop_2")/1000) - (feature.get("_pt_stop_1")/1000); // Getting the match percentage ptst_match_perc = (ptst_matchdiff * 100) / cell_int_ptst; // PUBLIC TRANSPORT STATIONS matching percentage ptsta_matchdiff = (ptsta_matchmax - ptsta_matchmin); cell_int_ptsta = (feature.get("_pt_stat_2")/1000) - (feature.get("_pt_stat_1")/1000); // Getting the match percentage ptsta_match_perc = (ptsta_matchdiff * 100) / cell_int_ptsta; // RESTAURANTS matching percentage resto_matchdiff = (resto_matchmax - resto_matchmin); cell_int_resto = (feature.get("_restaur_2")/1000) - (feature.get("_restaur_1")/1000); // Getting the match percentage resto_match_perc = (resto_matchdiff * 100) / cell_int_resto; // THEATRES matching percentage the_matchdiff = (the_matchmax - the_matchmin); cell_int_the = (feature.get("_theatre_2")/1000) - (feature.get("_theatre_1")/1000); // Getting the match percentage the_match_perc = (the_matchdiff * 100) / cell_int_the; // CINEMAS matching percentage cin_matchdiff = (cin_matchmax - cin_matchmin); cell_int_cin = (feature.get("_cinemasma")/1000) - (feature.get("_cinemasmi")/1000); // Getting the match percentage cin_match_perc = ( cin_matchdiff * 100) / cell_int_cin; // KINDERGARTENS matching percentage kin_matchdiff = (kin_matchmax - kin_matchmin); cell_int_kin = (feature.get("_kindermax")/1000) - (feature.get("_kindermin")/1000); // Getting the match percentage kin_match_perc = (kin_matchdiff * 100) / cell_int_kin; // INDUSTRIES matching percentage ind_matchdiff = (ind_matchmax - ind_matchmin); cell_int_ind = (feature.get("_industr_2")/1000) - (feature.get("_industr_1")/1000); // Getting the match percentage ind_match_perc = (ind_matchdiff * 100) / cell_int_ind; // WATER BODIES matching percentage wat_matchdiff = (wat_matchmax - wat_matchmin); cell_int_wat = (feature.get("_waterbo_2")/1000) - (feature.get("_waterbo_1")/1000); // Getting the match percentage wat_match_perc = (wat_matchdiff * 100) / cell_int_wat; // OVERALL PERCENTAGE CELL MATCH var new_fuzzy_value_1km_midtjylland = (ind_matchdiff + kin_matchdiff + cin_matchdiff + the_matchdiff + ptsta_matchdiff + ptst_matchdiff + resto_matchdiff + markets_matchdiff + roads_matchdiff + parks_matchdiff + uni_matchdiff + sch_matchdiff + coast_matchdiff + hos_matchdiff + wat_matchdiff)/ (cell_int_ind + cell_int_kin + cell_int_cin + cell_int_the + cell_int_resto + cell_int_ptsta + cell_int_ptst + cell_int_markets + cell_int_coast + cell_int_hos + cell_int_parks + cell_int_u + cell_int_sch + cell_int_roads + cell_int_wat); feature.set("fuzzyvalue", new_fuzzy_value_1km_midtjylland); accessibility = (((roads_matchdiff + ptsta_matchdiff + ptst_matchdiff)*100 / (cell_int_ptsta + cell_int_ptst + cell_int_roads))); livability = ((ind_matchdiff + kin_matchdiff + cin_matchdiff + the_matchdiff + resto_matchdiff + markets_matchdiff + parks_matchdiff + uni_matchdiff + sch_matchdiff + coast_matchdiff + hos_matchdiff + wat_matchdiff) * 100) / (cell_int_ind + cell_int_kin + cell_int_cin + cell_int_the + cell_int_resto + cell_int_markets+ cell_int_coast + cell_int_hos + cell_int_parks + cell_int_u +cell_int_sch + cell_int_wat); suitability = house_match_perc; feature.set("accessibility", accessibility); feature.set("livability", livability); feature.set("suitability", suitability); }); features_1km_midtjyllandw.forEach(function(feature ){ // MATCH PERCENTAGE FOR UNIVERSITIES // When user input doesn't match cell range if ((feature.get("_univers_1")/1000) > parseInt(sliderUni.value)) { uni_matchmax = 0; uni_matchmin = 0; } else if (parseInt(sliderUni.value) == (feature.get("_univers_1")/1000)) { uni_matchmax = 0; uni_matchmin = 0; } // Getting the maximum matching distance value else if ((feature.get("_univers_2")/1000) == parseInt(sliderUni.value)) { uni_matchmax = (feature.get("_univers_2")/1000); } else if ((feature.get("_univers_2")/1000) > parseInt(sliderUni.value)) { uni_matchmax = parseInt(sliderUni.value); } else if ((feature.get("_univers_2")/1000) < parseInt(sliderUni.value)) { uni_matchmax = (feature.get("_univers_2")/1000); } // Getting the minimum matching distance value else if ((feature.get("_univers_1")/1000) == 0) { uni_matchmin = 0; } else if ((feature.get("_univers_1") /1000 > 0)) { uni_matchmin = (feature.get("_univers_1")/1000); } // MATCH PERCENTAGE FOR SCHOOLS // When user input doesn 't match cell range if ((feature.get("_schoolsmi")/1000) > parseInt(sliderSchools.value)) { sch_matchmax = 0; sch_matchmin = 0; } else if (parseInt(sliderSchools.value) == (feature.get("_schoolsmi")/1000)) { sch_matchmax = 0; sch_matchmin = 0; } // Getting the maximum matching distance value else if ((feature.get("_schoolsma")/1000) == parseInt(sliderSchools.value)) { sch_matchmax = (feature.get("_schoolsma")/1000); } else if ((feature.get("_schoolsma")/1000) > parseInt(sliderSchools.value)) { sch_matchmax = parseInt(sliderSchools.value); } else if ((feature.get("_schoolsma")/1000) < parseInt(sliderSchools.value)) { sch_matchmax = (feature.get("_schoolsma")/1000); } // Getting the minimum matching distance value else if ((feature.get("_schoolsmi")/1000) == 0) { sch_matchmin = 0; } else if ((feature.get("_schoolsmi")/1000 > 0)) { sch_matchmin = (feature.get("_schoolsmi")/1000); } // MATCH PERCENTAGE FOR COASTLINE // When user input doesn 't match cell range if ((feature.get("_coastli_1")/1000) > parseInt(sliderCoasts.value)) { coast_matchmax = 0; coast_matchmin = 0; } else if (parseInt(sliderCoasts.value) == (feature.get("_coastli_1")/1000)) { coast_matchmax = 0; coast_matchmin = 0; } // Getting the maximum matching distance value else if ((feature.get("_coastli_2")/1000) == parseInt(sliderCoasts.value)) { coast_matchmax = (feature.get("_coastli_2")/1000); } else if ((feature.get("_coastli_2")/1000) > parseInt(sliderSchools.value)) { coast_matchmax = parseInt(sliderCoasts.value); } else if ((feature.get("_coastli_2")/1000) < parseInt(sliderCoasts.value)) { coast_matchmax = (feature.get("_coastli_2")/1000); } // Getting the minimum matching distance value else if ((feature.get("_coastli_1")/1000) == 0) { coast_matchmin = 0; } else if ((feature.get("_coastli_1")/1000 > 0)) { coast_matchmin = (feature.get("_coastli_1")/1000); } // MATCH PERCENTAGE FOR HOSPITALS // When user input doesn 't match cell range if ((feature.get("_hospita_1")/1000) > parseInt(sliderHospitals.value)) { hos_matchmax = 0; hos_matchmin = 0; } else if (parseInt(sliderHospitals.value) == (feature.get("_hospita_1")/1000)) { hos_matchmax = 0; hos_matchmin = 0; } // Getting the maximum matching distance value else if ((feature.get("_hospita_2")/1000) == parseInt(sliderHospitals.value)) { hos_matchmax = (feature.get("_hospita_2")/1000); } else if ((feature.get("_hospita_2")/1000) > parseInt(sliderHospitals.value)) { hos_matchmax = parseInt(sliderHospitals.value); } else if ((feature.get("_hospita_2")/1000) < parseInt(sliderHospitals.value)) { hos_matchmax = (feature.get("_hospita_2")/1000); } // Getting the minimum matching distance value else if ((feature.get("_hospita_1")/1000) == 0) { hos_matchmin = 0; } else if ((feature.get("_hospita_1")/1000 > 0)) { hos_matchmin = (feature.get("_hospita_1")/1000); } // MATCH PERCENTAGE FOR LEISURE PARKS // When user input doesn 't match cell range if ((feature.get("_leisure_1")/1000) > parseInt(sliderParks.value)) { parks_matchmax = 0; parks_matchmin = 0; } else if (parseInt(sliderParks.value) == (feature.get("_leisure_1") /1000)) { parks_matchmax = 0; parks_matchmin = 0; } // Getting the maximum matching distance value else if ((feature.get("_leisure_2")/1000) == parseInt(sliderParks.value)) { parks_matchmax = (feature.get("_leisure_2")/1000); } else if ((feature.get("_leisure_2")/1000) > parseInt(sliderParks.value)) { parks_matchmax = parseInt(sliderParks.value); } else if ((feature.get("_leisure_2")/1000) < parseInt(sliderParks.value)) { parks_matchmax = (feature.get("_leisure_2")/1000); } // Getting the minimum matching distance value else if ((feature.get("_leisure_1")/1000) == 0) { parks_matchmin = 0; } else if ((feature.get("_leisure_1")/1000 > 0)) { parks_matchmin = (feature.get("_leisure_1")/1000); } // MATCH PERCENTAGE FOR ROADS // When user input doesn 't match cell range if ((feature.get("_roadsmin")/1000) > parseInt(sliderRoads.value)) { roads_matchmax = 0; roads_matchmin = 0; } else if (parseInt(sliderRoads.value) == (feature.get("_roadsmin")/1000)) { roads_matchmax = 0; roads_matchmin = 0; } // Getting the maximum matching distance value else if ((feature.get("_roadsmax")/1000) == parseInt(sliderRoads.value)) { roads_matchmax = (feature.get("_roadsmax")/1000); } else if ((feature.get("_roadsmax")/1000) > parseInt(sliderRoads.value)) { roads_matchmax = parseInt(sliderRoads.value); } else if ((feature.get("_roadsmax")/1000) < parseInt(sliderRoads.value)) { roads_matchmax = (feature.get("_roadsmax")/1000); } // Getting the minimum matching distance value else if ((feature.get("_roadsmin")/1000) == 0) { roads_matchmin = 0; } else if ((feature.get("_roadsmin")/1000 > 0)) { roads_matchmin = (feature.get("_roadsmin")/1000); } // MATCH PERCENTAGE FOR SUPERMARKETS // When user input doesn 't match cell range if ((feature.get("_superma_1")/1000) > parseInt(sliderMarkets.value)) { markets_matchmax = 0; markets_matchmin = 0; } else if (parseInt(sliderMarkets.value) == (feature.get("_superma_1")/1000)) { markets_matchmax = 0; markets_matchmin = 0; } // Getting the maximum matching distance value else if ((feature.get("_superma_2")/1000) == parseInt(sliderMarkets.value)) { markets_matchmax = (feature.get("_superma_2")/1000); } else if ((feature.get("_superma_2")/1000) > parseInt(sliderMarkets.value)) { markets_matchmax = parseInt(sliderMarkets.value); } else if ((feature.get("_superma_2")/1000) < parseInt(sliderMarkets.value)) { markets_matchmax = (feature.get("_superma_2")/1000); } // Getting the minimum matching distance value else if ((feature.get("_superma_1")/1000) == 0) { markets_matchmin = 0; } else if ((feature.get("_superma_1")/1000 > 0)) { markets_matchmin = (feature.get("_superma_1")/1000); } // MATCH PERCENTAGE FOR PUBLIC TRANSPORT STOPS // When user input doesn't match cell range if ((feature.get("_pt_stop_1")/1000) > parseInt(sliderPstops.value)) { ptst_matchmax = 0; ptst_matchmin = 0; } else if (parseInt(sliderPstops.value) == (feature.get("_pt_stop_1")/1000)) { ptst_matchmax = 0; ptst_matchmin = 0; } // Getting the maximum matching distance value else if ((feature.get("_pt_stop_2")/1000) == parseInt(sliderPstops.value)) { ptst_matchmax = (feature.get("_pt_stop_2")/1000); } else if (( feature.get("_pt_stop_2")/1000) > parseInt(sliderPstops.value)) { ptst_matchmax = parseInt(sliderPstops.value); } else if ((feature.get("_pt_stop_2")/1000) < parseInt(sliderPstops.value)) { ptst_matchmax = (feature.get("_pt_stop_2")/1000); } // Getting the minimum matching distance value else if ((feature.get("_pt_stop_1")/1000) == 0) { ptst_matchmin = 0; } else if ((feature.get("_pt_stop_1") /1000 > 0)) { ptst_matchmin = (feature.get("_pt_stop_1")/1000); } // MATCH PERCENTAGE FOR PUBLIC TRANSPORT STATIONS // When user input doesn't match cell range if ((feature.get("_pt_stat_1")/1000) > parseInt(sliderPstations.value)) { ptsta_matchmax = 0; ptsta_matchmin = 0; } else if (parseInt(sliderPstations.value) == (feature.get("_pt_stat_1")/1000)) { ptsta_matchmax = 0; ptsta_matchmin = 0; } // Getting the maximum matching distance value else if ((feature.get("_pt_stat_2")/1000) == parseInt(sliderPstations.value)) { ptsta_matchmax = (feature.get("_pt_stat_2")/1000); } else if (( feature.get("_pt_stat_2")/1000) > parseInt(sliderPstations.value)) { ptsta_matchmax = parseInt(sliderPstations.value); } else if ((feature.get("_pt_stations_2")/1000) < parseInt(sliderPstations.value)) { ptsta_matchmax = (feature.get("_pt_stat_2")/1000); } // Getting the minimum matching distance value else if ((feature.get("_pt_stat_1")/1000) == 0) { ptsta_matchmin = 0; } else if ((feature.get("_pt_stat_1") /1000 > 0)) { ptsta_matchmin = (feature.get("_pt_stat_1")/1000); } // MATCH PERCENTAGE FOR RESTAURANTS // When user input doesn 't match cell range if ((feature.get("_restaur_1")/1000) > parseInt(sliderRestuarants.value)) { resto_matchmax = 0; resto_matchmin = 0; } else if (parseInt(sliderRestuarants.value) == (feature.get("_restaur_1")/1000)) { resto_matchmax = 0; resto_matchmin = 0; } // Getting the maximum matching distance value else if ((feature.get("_restaur_2")/1000) == parseInt(sliderRestuarants.value)) { resto_matchmax = (feature.get("_restaur_2")/1000); } else if ((feature.get("_restaur_2")/1000) > parseInt(sliderRestuarants.value)) { resto_matchmax = parseInt(sliderRestuarants.value); } else if ((feature.get("_restaur_2")/1000) < parseInt(sliderRestuarants.value)) { resto_matchmax = (feature.get("_restaur_2")/1000); } // Getting the minimum matching distance value else if ((feature.get("_restaur_1")/1000) == 0) { resto_matchmin = 0; } else if ((feature.get("_restaur_1")/1000 > 0)) { resto_matchmin = (feature.get("_restaur_1")/1000); } // MATCH PERCENTAGE FOR THEATRES // When user input doesn 't match cell range if ((feature.get("_theatre_1")/1000) > parseInt(sliderTheatres.value)) { the_matchmax = 0; the_matchmin = 0; } else if (parseInt(sliderTheatres.value) == (feature.get("_theatre_1")/1000)) { the_matchmax = 0; the_matchmin = 0; } // Getting the maximum matching distance value else if ((feature.get("_theatre_2")/1000) == parseInt(sliderTheatres.value)) { the_matchmax = (feature.get("_theatre_2")/1000); } else if ((feature.get("_theatre_2")/1000) > parseInt(sliderTheatres.value)) { the_matchmax = parseInt(sliderTheatres.value); } else if ((feature.get("_theatre_2")/1000) < parseInt(sliderTheatres.value)) { the_matchmax = (feature.get("_theatre_2")/1000); } // Getting the minimum matching distance value else if ((feature.get("_theatre_1")/1000) == 0) { the_matchmin = 0; } else if ((feature.get("_theatre_1")/1000 > 0)) { the_matchmin = (feature.get("_theatre_1")/1000); } // MATCH PERCENTAGE FOR CINEMAS // When user input doesn 't match cell range if ((feature.get("_cinemasmi")/1000) > parseInt(sliderCinemas.value)) { cin_matchmax = 0; cin_matchmin = 0; } else if (parseInt(sliderCinemas.value) == (feature.get("_cinemasmi")/1000)) { cin_matchmax = 0; cin_matchmin = 0; } // Getting the maximum matching distance value else if ((feature.get("_cinemasma")/1000) == parseInt(sliderCinemas.value)) { cin_matchmax = (feature.get("_cinemasma")/1000); } else if ((feature.get("_cinemasma")/1000) > parseInt(sliderCinemas.value)) { cin_matchmax = parseInt(sliderCinemas.value); } else if ((feature.get("_cinemasma")/1000) < parseInt(sliderCinemas.value)) { cin_matchmax = (feature.get("_cinemasma")/1000); } // Getting the minimum matching distance value else if ((feature.get("_cinemasmi")/1000) == 0) { cin_matchmin = 0; } else if ((feature.get("_cinemasmi")/1000 > 0)) { cin_matchmin = (feature.get("_cinemasmi")/1000); } // MATCH PERCENTAGE FOR KINDERGARTENS // When user input doesn 't match cell range if ((feature.get("_kindermin")/1000) > parseInt(sliderKinder.value)) { kin_matchmax = 0; kin_matchmin = 0; } else if (parseInt(sliderKinder.value) == (feature.get("_kindermin")/1000)) { kin_matchmax = 0; kin_matchmin = 0; } // Getting the maximum matching distance value else if ((feature.get("_kindermax")/1000) == parseInt(sliderKinder.value)) { kin_matchmax = (feature.get("_kindermax")/1000); } else if ((feature.get("_kindermax")/1000) > parseInt(sliderKinder.value)) { kin_matchmax = parseInt(sliderKinder.value); } else if ((feature.get("_kindermax")/1000) < parseInt(sliderKinder.value)) { kin_matchmax = (feature.get("_kindermax")/1000); } // Getting the minimum matching distance value else if ((feature.get("_kindermin")/1000) == 0) { kin_matchmin = 0; } else if ((feature.get("_kindermin")/1000 > 0)) { kin_matchmin = (feature.get("_kindermin")/1000); } // MATCH PERCENTAGE FOR INDUSTRIES // When user input doesn 't match cell range if ((feature.get("_industr_1")/1000) > parseInt(sliderIndustry.value)) { ind_matchmax = 0; ind_matchmin = 0; } else if (parseInt(sliderIndustry.value) == (feature.get("_industr_1")/1000)) { ind_matchmax = 0; ind_matchmin = 0; } // Getting the maximum matching distance value else if ((feature.get("_industr_2")/1000) == parseInt(sliderIndustry.value)) { } else if ((feature.get("_industr_2")/1000) > parseInt(sliderIndustry.value)) { ind_matchmax = parseInt(sliderIndustry.value); } else if ((feature.get("_industr_2")/1000) < parseInt(sliderIndustry.value)) { ind_matchmax = (feature.get("_industr_2")/1000); } // Getting the minimum matching distance value else if ((feature.get("_industr_1")/1000) == 0) { ind_matchmin = 0; } else if ((feature.get("_industr_1")/1000 > 0)) { ind_matchmin = (feature.get("_industr_1")/1000); } // MATCH PERCENTAGE FOR WATER BODIES // When user input doesn 't match cell range if ((feature.get("_waterbo_1")) > parseInt(sliderWater.value)) { wat_matchmax = 0; wat_matchmin = 0; } else if (parseInt(sliderWater.value) == (feature.get("_waterbo_1"))) { wat_matchmax = 0; wat_matchmin = 0; } // Getting the maximum matching distance value else if ((feature.get("_waterbo_2")) == parseInt(sliderWater.value)) { wat_matchmax = (feature.get("_waterbo_2")); } else if ((feature.get("_waterbo_2")) > parseInt(sliderWater.value)) { wat_matchmax = parseInt(sliderWater.value); } else if ((feature.get("_waterbo_2")) < parseInt(sliderWater.value)) { wat_matchmax = (feature.get("_waterbo_2")); } // Getting the minimum matching distance value else if ((feature.get("_waterbo_1")) == 0) { wat_matchmin = 0; } else if ((feature.get("_waterbo_1")) > 0){ wat_matchmin = (feature.get("_waterbo_1")); } // MATCH PERCENTAGE FOR HOUSE PRICES if ((feature.get("housepri_2")) > parseInt(sliderHprice.value)) { house_match_perc = 0; //Out of the cell interval } else {(((feature.get("housepri_2") == parseInt(sliderHprice.value)) || (parseInt(sliderHprice.value) > (feature.get("housepri_2"))))) house_match_perc = 100; //Within the cell interval } //UNIVERSITIES matching percentage uni_matchdiff = (uni_matchmax - uni_matchmin); cell_int_u = (feature.get("_univers_2")/1000) - (feature.get("_univers_1")/1000); // Getting the match percentage uni_match_perc = (uni_matchdiff * 100) / cell_int_u; //SCHOOLS matching percentage sch_matchdiff = (sch_matchmax - sch_matchmin); cell_int_sch = (feature.get("_schoolsma")/1000) - (feature.get("_schoolsmi")/1000); // Getting the match percentage sch_match_perc = (sch_matchdiff * 100) / cell_int_sch; //COASTLINE matching percentage coast_matchdiff = (coast_matchmax - coast_matchmin); cell_int_coast = (feature.get("_coastli_2")/1000) - (feature.get("_coastli_1")/1000); // Getting the match percentage coast_match_perc = (coast_matchdiff * 100) / cell_int_coast; //HOSPITALS matching percentage hos_matchdiff = (hos_matchmax - hos_matchmin); cell_int_hos = (feature.get("_hospita_2")/1000) - (feature.get("_hospita_1")/1000); // Getting the match percentage hos_match_perc = (hos_matchdiff * 100) / cell_int_hos; //PARKS matching percentage parks_matchdiff = (parks_matchmax - parks_matchmin); cell_int_parks = (feature.get("_leisure_2")/1000) - (feature.get("_leisure_1")/1000); // Getting the match percentage parks_match_perc = (parks_matchdiff * 100) / cell_int_parks; // ROADS matching percentage roads_matchdiff = (roads_matchmax - roads_matchmin); cell_int_roads = (feature.get("_roadsmax")/1000) - (feature.get("_roadsmin")/1000); // Getting the match percentage roads_match_perc = (roads_matchdiff * 100) / cell_int_roads; // SUPERMARKETS matching percentage markets_matchdiff = (markets_matchmax - markets_matchmin); cell_int_markets = (feature.get("_superma_2")/1000) - (feature.get("_superma_1")/1000); // Getting the match percentage markets_match_perc = (markets_matchdiff * 100) / cell_int_markets; // PUBLIC TRANSPORT STOPS matching percentage ptst_matchdiff = (ptst_matchmax - ptst_matchmin); cell_int_ptst = (feature.get("_pt_stop_2")/1000) - (feature.get("_pt_stop_1")/1000); // Getting the match percentage ptst_match_perc = (ptst_matchdiff * 100) / cell_int_ptst; // PUBLIC TRANSPORT STATIONS matching percentage ptsta_matchdiff = (ptsta_matchmax - ptsta_matchmin); cell_int_ptsta = (feature.get("_pt_stat_2")/1000) - (feature.get("_pt_stat_1")/1000); // Getting the match percentage ptsta_match_perc = (ptsta_matchdiff * 100) / cell_int_ptsta; // RESTAURANTS matching percentage resto_matchdiff = (resto_matchmax - resto_matchmin); cell_int_resto = (feature.get("_restaur_2")/1000) - (feature.get("_restaur_1")/1000); // Getting the match percentage resto_match_perc = (resto_matchdiff * 100) / cell_int_resto; // THEATRES matching percentage the_matchdiff = (the_matchmax - the_matchmin); cell_int_the = (feature.get("_theatre_2")/1000) - (feature.get("_theatre_1")/1000); // Getting the match percentage the_match_perc = (the_matchdiff * 100) / cell_int_the; // CINEMAS matching percentage cin_matchdiff = (cin_matchmax - cin_matchmin); cell_int_cin = (feature.get("_cinemasma")/1000) - (feature.get("_cinemasmi")/1000); // Getting the match percentage cin_match_perc = ( cin_matchdiff * 100) / cell_int_cin; // KINDERGARTENS matching percentage kin_matchdiff = (kin_matchmax - kin_matchmin); cell_int_kin = (feature.get("_kindermax")/1000) - (feature.get("_kindermin")/1000); // Getting the match percentage kin_match_perc = (kin_matchdiff * 100) / cell_int_kin; // INDUSTRIES matching percentage ind_matchdiff = (ind_matchmax - ind_matchmin); cell_int_ind = (feature.get("_industr_2")/1000) - (feature.get("_industr_1")/1000); // Getting the match percentage ind_match_perc = (ind_matchdiff * 100) / cell_int_ind; // WATER BODIES matching percentage wat_matchdiff = (wat_matchmax - wat_matchmin); cell_int_wat = (feature.get("_waterbo_2")/1000) - (feature.get("_waterbo_1")/1000); // Getting the match percentage wat_match_perc = (wat_matchdiff * 100) / cell_int_wat; // OVERALL PERCENTAGE CELL MATCH var new_fuzzy_value_1km_midtjyllandw = (ind_matchdiff + kin_matchdiff + cin_matchdiff + the_matchdiff + ptsta_matchdiff + ptst_matchdiff + resto_matchdiff + markets_matchdiff + roads_matchdiff + parks_matchdiff + uni_matchdiff + sch_matchdiff + coast_matchdiff + hos_matchdiff + wat_matchdiff)/ (cell_int_ind + cell_int_kin + cell_int_cin + cell_int_the + cell_int_resto + cell_int_ptsta + cell_int_ptst + cell_int_markets + cell_int_coast + cell_int_hos + cell_int_parks + cell_int_u + cell_int_sch + cell_int_roads + cell_int_wat); feature.set("fuzzyvalue", new_fuzzy_value_1km_midtjyllandw); accessibility = (((roads_matchdiff + ptsta_matchdiff + ptst_matchdiff)*100 / (cell_int_ptsta + cell_int_ptst + cell_int_roads))); livability = ((ind_matchdiff + kin_matchdiff + cin_matchdiff + the_matchdiff + resto_matchdiff + markets_matchdiff + parks_matchdiff + uni_matchdiff + sch_matchdiff + coast_matchdiff + hos_matchdiff + wat_matchdiff) * 100) / (cell_int_ind + cell_int_kin + cell_int_cin + cell_int_the + cell_int_resto + cell_int_markets+ cell_int_coast + cell_int_hos + cell_int_parks + cell_int_u +cell_int_sch + cell_int_wat); suitability = house_match_perc; feature.set("accessibility", accessibility); feature.set("livability", livability); feature.set("suitability", suitability); }); features_1km_sjælland.forEach(function(feature ){ // MATCH PERCENTAGE FOR UNIVERSITIES // When user input doesn't match cell range if ((feature.get("_univers_1")/1000) > parseInt(sliderUni.value)) { uni_matchmax = 0; uni_matchmin = 0; } else if (parseInt(sliderUni.value) == (feature.get("_univers_1")/1000)) { uni_matchmax = 0; uni_matchmin = 0; } // Getting the maximum matching distance value else if ((feature.get("_univers_2")/1000) == parseInt(sliderUni.value)) { uni_matchmax = (feature.get("_univers_2")/1000); } else if ((feature.get("_univers_2")/1000) > parseInt(sliderUni.value)) { uni_matchmax = parseInt(sliderUni.value); } else if ((feature.get("_univers_2")/1000) < parseInt(sliderUni.value)) { uni_matchmax = (feature.get("_univers_2")/1000); } // Getting the minimum matching distance value else if ((feature.get("_univers_1")/1000) == 0) { uni_matchmin = 0; } else if ((feature.get("_univers_1") /1000 > 0)) { uni_matchmin = (feature.get("_univers_1")/1000); } // MATCH PERCENTAGE FOR SCHOOLS // When user input doesn 't match cell range if ((feature.get("_schoolsmi")/1000) > parseInt(sliderSchools.value)) { sch_matchmax = 0; sch_matchmin = 0; } else if (parseInt(sliderSchools.value) == (feature.get("_schoolsmi")/1000)) { sch_matchmax = 0; sch_matchmin = 0; } // Getting the maximum matching distance value else if ((feature.get("_schoolsma")/1000) == parseInt(sliderSchools.value)) { sch_matchmax = (feature.get("_schoolsma")/1000); } else if ((feature.get("_schoolsma")/1000) > parseInt(sliderSchools.value)) { sch_matchmax = parseInt(sliderSchools.value); } else if ((feature.get("_schoolsma")/1000) < parseInt(sliderSchools.value)) { sch_matchmax = (feature.get("_schoolsma")/1000); } // Getting the minimum matching distance value else if ((feature.get("_schoolsmi")/1000) == 0) { sch_matchmin = 0; } else if ((feature.get("_schoolsmi")/1000 > 0)) { sch_matchmin = (feature.get("_schoolsmi")/1000); } // MATCH PERCENTAGE FOR COASTLINE // When user input doesn 't match cell range if ((feature.get("_coastli_1")/1000) > parseInt(sliderCoasts.value)) { coast_matchmax = 0; coast_matchmin = 0; } else if (parseInt(sliderCoasts.value) == (feature.get("_coastli_1")/1000)) { coast_matchmax = 0; coast_matchmin = 0; } // Getting the maximum matching distance value else if ((feature.get("_coastli_2")/1000) == parseInt(sliderCoasts.value)) { coast_matchmax = (feature.get("_coastli_2")/1000); } else if ((feature.get("_coastli_2")/1000) > parseInt(sliderSchools.value)) { coast_matchmax = parseInt(sliderCoasts.value); } else if ((feature.get("_coastli_2")/1000) < parseInt(sliderCoasts.value)) { coast_matchmax = (feature.get("_coastli_2")/1000); } // Getting the minimum matching distance value else if ((feature.get("_coastli_1")/1000) == 0) { coast_matchmin = 0; } else if ((feature.get("_coastli_1")/1000 > 0)) { coast_matchmin = (feature.get("_coastli_1")/1000); } // MATCH PERCENTAGE FOR HOSPITALS // When user input doesn 't match cell range if ((feature.get("_hospita_1")/1000) > parseInt(sliderHospitals.value)) { hos_matchmax = 0; hos_matchmin = 0; } else if (parseInt(sliderHospitals.value) == (feature.get("_hospita_1")/1000)) { hos_matchmax = 0; hos_matchmin = 0; } // Getting the maximum matching distance value else if ((feature.get("_hospita_2")/1000) == parseInt(sliderHospitals.value)) { hos_matchmax = (feature.get("_hospita_2")/1000); } else if ((feature.get("_hospita_2")/1000) > parseInt(sliderHospitals.value)) { hos_matchmax = parseInt(sliderHospitals.value); } else if ((feature.get("_hospita_2")/1000) < parseInt(sliderHospitals.value)) { hos_matchmax = (feature.get("_hospita_2")/1000); } // Getting the minimum matching distance value else if ((feature.get("_hospita_1")/1000) == 0) { hos_matchmin = 0; } else if ((feature.get("_hospita_1")/1000 > 0)) { hos_matchmin = (feature.get("_hospita_1")/1000); } // MATCH PERCENTAGE FOR LEISURE PARKS // When user input doesn 't match cell range if ((feature.get("_leisure_1")/1000) > parseInt(sliderParks.value)) { parks_matchmax = 0; parks_matchmin = 0; } else if (parseInt(sliderParks.value) == (feature.get("_leisure_1") /1000)) { parks_matchmax = 0; parks_matchmin = 0; } // Getting the maximum matching distance value else if ((feature.get("_leisure_2")/1000) == parseInt(sliderParks.value)) { parks_matchmax = (feature.get("_leisure_2")/1000); } else if ((feature.get("_leisure_2")/1000) > parseInt(sliderParks.value)) { parks_matchmax = parseInt(sliderParks.value); } else if ((feature.get("_leisure_2")/1000) < parseInt(sliderParks.value)) { parks_matchmax = (feature.get("_leisure_2")/1000); } // Getting the minimum matching distance value else if ((feature.get("_leisure_1")/1000) == 0) { parks_matchmin = 0; } else if ((feature.get("_leisure_1")/1000 > 0)) { parks_matchmin = (feature.get("_leisure_1")/1000); } // MATCH PERCENTAGE FOR ROADS // When user input doesn 't match cell range if ((feature.get("_roadsmin")/1000) > parseInt(sliderRoads.value)) { roads_matchmax = 0; roads_matchmin = 0; } else if (parseInt(sliderRoads.value) == (feature.get("_roadsmin")/1000)) { roads_matchmax = 0; roads_matchmin = 0; } // Getting the maximum matching distance value else if ((feature.get("_roadsmax")/1000) == parseInt(sliderRoads.value)) { roads_matchmax = (feature.get("_roadsmax")/1000); } else if ((feature.get("_roadsmax")/1000) > parseInt(sliderRoads.value)) { roads_matchmax = parseInt(sliderRoads.value); } else if ((feature.get("_roadsmax")/1000) < parseInt(sliderRoads.value)) { roads_matchmax = (feature.get("_roadsmax")/1000); } // Getting the minimum matching distance value else if ((feature.get("_roadsmin")/1000) == 0) { roads_matchmin = 0; } else if ((feature.get("_roadsmin")/1000 > 0)) { roads_matchmin = (feature.get("_roadsmin")/1000); } // MATCH PERCENTAGE FOR SUPERMARKETS // When user input doesn 't match cell range if ((feature.get("_superma_1")/1000) > parseInt(sliderMarkets.value)) { markets_matchmax = 0; markets_matchmin = 0; } else if (parseInt(sliderMarkets.value) == (feature.get("_superma_1")/1000)) { markets_matchmax = 0; markets_matchmin = 0; } // Getting the maximum matching distance value else if ((feature.get("_superma_2")/1000) == parseInt(sliderMarkets.value)) { markets_matchmax = (feature.get("_superma_2")/1000); } else if ((feature.get("_superma_2")/1000) > parseInt(sliderMarkets.value)) { markets_matchmax = parseInt(sliderMarkets.value); } else if ((feature.get("_superma_2")/1000) < parseInt(sliderMarkets.value)) { markets_matchmax = (feature.get("_superma_2")/1000); } // Getting the minimum matching distance value else if ((feature.get("_superma_1")/1000) == 0) { markets_matchmin = 0; } else if ((feature.get("_superma_1")/1000 > 0)) { markets_matchmin = (feature.get("_superma_1")/1000); } // MATCH PERCENTAGE FOR PUBLIC TRANSPORT STOPS // When user input doesn't match cell range if ((feature.get("_pt_stop_1")/1000) > parseInt(sliderPstops.value)) { ptst_matchmax = 0; ptst_matchmin = 0; } else if (parseInt(sliderPstops.value) == (feature.get("_pt_stop_1")/1000)) { ptst_matchmax = 0; ptst_matchmin = 0; } // Getting the maximum matching distance value else if ((feature.get("_pt_stop_2")/1000) == parseInt(sliderPstops.value)) { ptst_matchmax = (feature.get("_pt_stop_2")/1000); } else if (( feature.get("_pt_stop_2")/1000) > parseInt(sliderPstops.value)) { ptst_matchmax = parseInt(sliderPstops.value); } else if ((feature.get("_pt_stop_2")/1000) < parseInt(sliderPstops.value)) { ptst_matchmax = (feature.get("_pt_stop_2")/1000); } // Getting the minimum matching distance value else if ((feature.get("_pt_stop_1")/1000) == 0) { ptst_matchmin = 0; } else if ((feature.get("_pt_stop_1") /1000 > 0)) { ptst_matchmin = (feature.get("_pt_stop_1")/1000); } // MATCH PERCENTAGE FOR PUBLIC TRANSPORT STATIONS // When user input doesn't match cell range if ((feature.get("_pt_stat_1")/1000) > parseInt(sliderPstations.value)) { ptsta_matchmax = 0; ptsta_matchmin = 0; } else if (parseInt(sliderPstations.value) == (feature.get("_pt_stat_1")/1000)) { ptsta_matchmax = 0; ptsta_matchmin = 0; } // Getting the maximum matching distance value else if ((feature.get("_pt_stat_2")/1000) == parseInt(sliderPstations.value)) { ptsta_matchmax = (feature.get("_pt_stat_2")/1000); } else if (( feature.get("_pt_stat_2")/1000) > parseInt(sliderPstations.value)) { ptsta_matchmax = parseInt(sliderPstations.value); } else if ((feature.get("_pt_stations_2")/1000) < parseInt(sliderPstations.value)) { ptsta_matchmax = (feature.get("_pt_stat_2")/1000); } // Getting the minimum matching distance value else if ((feature.get("_pt_stat_1")/1000) == 0) { ptsta_matchmin = 0; } else if ((feature.get("_pt_stat_1") /1000 > 0)) { ptsta_matchmin = (feature.get("_pt_stat_1")/1000); } // MATCH PERCENTAGE FOR RESTAURANTS // When user input doesn 't match cell range if ((feature.get("_restaur_1")/1000) > parseInt(sliderRestuarants.value)) { resto_matchmax = 0; resto_matchmin = 0; } else if (parseInt(sliderRestuarants.value) == (feature.get("_restaur_1")/1000)) { resto_matchmax = 0; resto_matchmin = 0; } // Getting the maximum matching distance value else if ((feature.get("_restaur_2")/1000) == parseInt(sliderRestuarants.value)) { resto_matchmax = (feature.get("_restaur_2")/1000); } else if ((feature.get("_restaur_2")/1000) > parseInt(sliderRestuarants.value)) { resto_matchmax = parseInt(sliderRestuarants.value); } else if ((feature.get("_restaur_2")/1000) < parseInt(sliderRestuarants.value)) { resto_matchmax = (feature.get("_restaur_2")/1000); } // Getting the minimum matching distance value else if ((feature.get("_restaur_1")/1000) == 0) { resto_matchmin = 0; } else if ((feature.get("_restaur_1")/1000 > 0)) { resto_matchmin = (feature.get("_restaur_1")/1000); } // MATCH PERCENTAGE FOR THEATRES // When user input doesn 't match cell range if ((feature.get("_theatre_1")/1000) > parseInt(sliderTheatres.value)) { the_matchmax = 0; the_matchmin = 0; } else if (parseInt(sliderTheatres.value) == (feature.get("_theatre_1")/1000)) { the_matchmax = 0; the_matchmin = 0; } // Getting the maximum matching distance value else if ((feature.get("_theatre_2")/1000) == parseInt(sliderTheatres.value)) { the_matchmax = (feature.get("_theatre_2")/1000); } else if ((feature.get("_theatre_2")/1000) > parseInt(sliderTheatres.value)) { the_matchmax = parseInt(sliderTheatres.value); } else if ((feature.get("_theatre_2")/1000) < parseInt(sliderTheatres.value)) { the_matchmax = (feature.get("_theatre_2")/1000); } // Getting the minimum matching distance value else if ((feature.get("_theatre_1")/1000) == 0) { the_matchmin = 0; } else if ((feature.get("_theatre_1")/1000 > 0)) { the_matchmin = (feature.get("_theatre_1")/1000); } // MATCH PERCENTAGE FOR CINEMAS // When user input doesn 't match cell range if ((feature.get("_cinemasmi")/1000) > parseInt(sliderCinemas.value)) { cin_matchmax = 0; cin_matchmin = 0; } else if (parseInt(sliderCinemas.value) == (feature.get("_cinemasmi")/1000)) { cin_matchmax = 0; cin_matchmin = 0; } // Getting the maximum matching distance value else if ((feature.get("_cinemasma")/1000) == parseInt(sliderCinemas.value)) { cin_matchmax = (feature.get("_cinemasma")/1000); } else if ((feature.get("_cinemasma")/1000) > parseInt(sliderCinemas.value)) { cin_matchmax = parseInt(sliderCinemas.value); } else if ((feature.get("_cinemasma")/1000) < parseInt(sliderCinemas.value)) { cin_matchmax = (feature.get("_cinemasma")/1000); } // Getting the minimum matching distance value else if ((feature.get("_cinemasmi")/1000) == 0) { cin_matchmin = 0; } else if ((feature.get("_cinemasmi")/1000 > 0)) { cin_matchmin = (feature.get("_cinemasmi")/1000); } // MATCH PERCENTAGE FOR KINDERGARTENS // When user input doesn 't match cell range if ((feature.get("_kindermin")/1000) > parseInt(sliderKinder.value)) { kin_matchmax = 0; kin_matchmin = 0; } else if (parseInt(sliderKinder.value) == (feature.get("_kindermin")/1000)) { kin_matchmax = 0; kin_matchmin = 0; } // Getting the maximum matching distance value else if ((feature.get("_kindermax")/1000) == parseInt(sliderKinder.value)) { kin_matchmax = (feature.get("_kindermax")/1000); } else if ((feature.get("_kindermax")/1000) > parseInt(sliderKinder.value)) { kin_matchmax = parseInt(sliderKinder.value); } else if ((feature.get("_kindermax")/1000) < parseInt(sliderKinder.value)) { kin_matchmax = (feature.get("_kindermax")/1000); } // Getting the minimum matching distance value else if ((feature.get("_kindermin")/1000) == 0) { kin_matchmin = 0; } else if ((feature.get("_kindermin")/1000 > 0)) { kin_matchmin = (feature.get("_kindermin")/1000); } // MATCH PERCENTAGE FOR INDUSTRIES // When user input doesn 't match cell range if ((feature.get("_industr_1")/1000) > parseInt(sliderIndustry.value)) { ind_matchmax = 0; ind_matchmin = 0; } else if (parseInt(sliderIndustry.value) == (feature.get("_industr_1")/1000)) { ind_matchmax = 0; ind_matchmin = 0; } // Getting the maximum matching distance value else if ((feature.get("_industr_2")/1000) == parseInt(sliderIndustry.value)) { } else if ((feature.get("_industr_2")/1000) > parseInt(sliderIndustry.value)) { ind_matchmax = parseInt(sliderIndustry.value); } else if ((feature.get("_industr_2")/1000) < parseInt(sliderIndustry.value)) { ind_matchmax = (feature.get("_industr_2")/1000); } // Getting the minimum matching distance value else if ((feature.get("_industr_1")/1000) == 0) { ind_matchmin = 0; } else if ((feature.get("_industr_1")/1000 > 0)) { ind_matchmin = (feature.get("_industr_1")/1000); } // MATCH PERCENTAGE FOR WATER BODIES // When user input doesn 't match cell range if ((feature.get("_waterbo_1")) > parseInt(sliderWater.value)) { wat_matchmax = 0; wat_matchmin = 0; } else if (parseInt(sliderWater.value) == (feature.get("_waterbo_1"))) { wat_matchmax = 0; wat_matchmin = 0; } // Getting the maximum matching distance value else if ((feature.get("_waterbo_2")) == parseInt(sliderWater.value)) { wat_matchmax = (feature.get("_waterbo_2")); } else if ((feature.get("_waterbo_2")) > parseInt(sliderWater.value)) { wat_matchmax = parseInt(sliderWater.value); } else if ((feature.get("_waterbo_2")) < parseInt(sliderWater.value)) { wat_matchmax = (feature.get("_waterbo_2")); } // Getting the minimum matching distance value else if ((feature.get("_waterbo_1")) == 0) { wat_matchmin = 0; } else if((feature.get("_waterbo_1")) > 0){ wat_matchmin = (feature.get("_waterbo_1")); } // MATCH PERCENTAGE FOR HOUSE PRICES if ((feature.get("housepri_2")) > parseInt(sliderHprice.value)) { house_match_perc = 0; //Out of the cell interval } else {(((feature.get("housepri_2") == parseInt(sliderHprice.value)) || (parseInt(sliderHprice.value) > (feature.get("housepri_2"))))) house_match_perc = 100; //Within the cell interval } //UNIVERSITIES matching percentage uni_matchdiff = (uni_matchmax - uni_matchmin); cell_int_u = (feature.get("_univers_2")/1000) - (feature.get("_univers_1")/1000); // Getting the match percentage uni_match_perc = (uni_matchdiff * 100) / cell_int_u; //SCHOOLS matching percentage sch_matchdiff = (sch_matchmax - sch_matchmin); cell_int_sch = (feature.get("_schoolsma")/1000) - (feature.get("_schoolsmi")/1000); // Getting the match percentage sch_match_perc = (sch_matchdiff * 100) / cell_int_sch; //COASTLINE matching percentage coast_matchdiff = (coast_matchmax - coast_matchmin); cell_int_coast = (feature.get("_coastli_2")/1000) - (feature.get("_coastli_1")/1000); // Getting the match percentage coast_match_perc = (coast_matchdiff * 100) / cell_int_coast; //HOSPITALS matching percentage hos_matchdiff = (hos_matchmax - hos_matchmin); cell_int_hos = (feature.get("_hospita_2")/1000) - (feature.get("_hospita_1")/1000); // Getting the match percentage hos_match_perc = (hos_matchdiff * 100) / cell_int_hos; //PARKS matching percentage parks_matchdiff = (parks_matchmax - parks_matchmin); cell_int_parks = (feature.get("_leisure_2")/1000) - (feature.get("_leisure_1")/1000); // Getting the match percentage parks_match_perc = (parks_matchdiff * 100) / cell_int_parks; // ROADS matching percentage roads_matchdiff = (roads_matchmax - roads_matchmin); cell_int_roads = (feature.get("_roadsmax")/1000) - (feature.get("_roadsmin")/1000); // Getting the match percentage roads_match_perc = (roads_matchdiff * 100) / cell_int_roads; // SUPERMARKETS matching percentage markets_matchdiff = (markets_matchmax - markets_matchmin); cell_int_markets = (feature.get("_superma_2")/1000) - (feature.get("_superma_1")/1000); // Getting the match percentage markets_match_perc = (markets_matchdiff * 100) / cell_int_markets; // PUBLIC TRANSPORT STOPS matching percentage ptst_matchdiff = (ptst_matchmax - ptst_matchmin); cell_int_ptst = (feature.get("_pt_stop_2")/1000) - (feature.get("_pt_stop_1")/1000); // Getting the match percentage ptst_match_perc = (ptst_matchdiff * 100) / cell_int_ptst; // PUBLIC TRANSPORT STATIONS matching percentage ptsta_matchdiff = (ptsta_matchmax - ptsta_matchmin); cell_int_ptsta = (feature.get("_pt_stat_2")/1000) - (feature.get("_pt_stat_1")/1000); // Getting the match percentage ptsta_match_perc = (ptsta_matchdiff * 100) / cell_int_ptsta; // RESTAURANTS matching percentage resto_matchdiff = (resto_matchmax - resto_matchmin); cell_int_resto = (feature.get("_restaur_2")/1000) - (feature.get("_restaur_1")/1000); // Getting the match percentage resto_match_perc = (resto_matchdiff * 100) / cell_int_resto; // THEATRES matching percentage the_matchdiff = (the_matchmax - the_matchmin); cell_int_the = (feature.get("_theatre_2")/1000) - (feature.get("_theatre_1")/1000); // Getting the match percentage the_match_perc = (the_matchdiff * 100) / cell_int_the; // CINEMAS matching percentage cin_matchdiff = (cin_matchmax - cin_matchmin); cell_int_cin = (feature.get("_cinemasma")/1000) - (feature.get("_cinemasmi")/1000); // Getting the match percentage cin_match_perc = ( cin_matchdiff * 100) / cell_int_cin; // KINDERGARTENS matching percentage kin_matchdiff = (kin_matchmax - kin_matchmin); cell_int_kin = (feature.get("_kindermax")/1000) - (feature.get("_kindermin")/1000); // Getting the match percentage kin_match_perc = (kin_matchdiff * 100) / cell_int_kin; // INDUSTRIES matching percentage ind_matchdiff = (ind_matchmax - ind_matchmin); cell_int_ind = (feature.get("_industr_2")/1000) - (feature.get("_industr_1")/1000); // Getting the match percentage ind_match_perc = (ind_matchdiff * 100) / cell_int_ind; // WATER BODIES matching percentage wat_matchdiff = (wat_matchmax - wat_matchmin); cell_int_wat = (feature.get("_waterbo_2")/1000) - (feature.get("_waterbo_1")/1000); // Getting the match percentage wat_match_perc = (wat_matchdiff * 100) / cell_int_wat; // OVERALL PERCENTAGE CELL MATCH var new_fuzzy_value_1km_sjælland = (ind_matchdiff + kin_matchdiff + cin_matchdiff + the_matchdiff + ptsta_matchdiff + ptst_matchdiff + resto_matchdiff + markets_matchdiff + roads_matchdiff + parks_matchdiff + uni_matchdiff + sch_matchdiff + coast_matchdiff + hos_matchdiff + wat_matchdiff)/ (cell_int_ind + cell_int_kin + cell_int_cin + cell_int_the + cell_int_resto + cell_int_ptsta + cell_int_ptst + cell_int_markets + cell_int_coast + cell_int_hos + cell_int_parks + cell_int_u + cell_int_sch + cell_int_roads + cell_int_wat); feature.set("fuzzyvalue", new_fuzzy_value_1km_sjælland); accessibility = (((roads_matchdiff + ptsta_matchdiff + ptst_matchdiff)*100 / (cell_int_ptsta + cell_int_ptst + cell_int_roads))); livability = ((ind_matchdiff + kin_matchdiff + cin_matchdiff + the_matchdiff + resto_matchdiff + markets_matchdiff + parks_matchdiff + uni_matchdiff + sch_matchdiff + coast_matchdiff + hos_matchdiff + wat_matchdiff) * 100) / (cell_int_ind + cell_int_kin + cell_int_cin + cell_int_the + cell_int_resto + cell_int_markets+ cell_int_coast + cell_int_hos + cell_int_parks + cell_int_u +cell_int_sch + cell_int_wat); suitability = house_match_perc; feature.set("accessibility", accessibility); feature.set("livability", livability); feature.set("suitability", suitability); }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function glyphsMainSearchInput(searchSetID, str, e) {\n var searchset = document.getElementById(searchSetID);\n if(!searchset) { return; }\n \n var searchInput = document.getElementById(searchSetID + \"_inputID\");\n if(searchInput.show_default_message) { return; }\n\n if(!str) {\n if(searchInput) { str =...
[ "0.62385285", "0.6066653", "0.5963924", "0.5963754", "0.59636915", "0.5899621", "0.586253", "0.5840317", "0.57780284", "0.57727027", "0.57611465", "0.5751414", "0.5722691", "0.5721347", "0.5705847", "0.5699681", "0.5687383", "0.56703925", "0.5662239", "0.5662072", "0.5647238"...
0.56525123
20
Function Definitions The StateAvailable function will be called when self.state[] has valid information for the requested entity state is the initial state Methods
function OnStateAvailable(self, state) { self.min = state.attributes.min_temp self.max = state.attributes.max_temp self.level = state.attributes.temperature if ("units" in self.parameters) { self.set_field(self, "units", self.parameters.units) } else { self.set_field(self, "units", state.attributes["unit_of_measurement"]) } set_view(self, state) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function OnStateAvailable(self, state)\n {\n self.set_field(self, \"state\", self.map_state(self, state.state))\n }", "function OnStateAvailable(self, state)\n {\n self.set_field(self, \"state\", self.map_state(self, state.state))\n }", "function OnStateAvailable(self, state)\n {\n...
[ "0.73287344", "0.73287344", "0.6968565", "0.6968565", "0.6968565", "0.6968565", "0.6926128", "0.6789413", "0.66253674", "0.6582287", "0.65430224", "0.64888936", "0.64888936", "0.64888936", "0.6190595", "0.61709887", "0.6154469", "0.6125979", "0.5983027", "0.5983027", "0.59440...
0.6310257
14
Function Definitions The StateAvailable function will be called when self.state[] has valid information for the requested entity state is the initial state Methods
function OnChange(self, state) { if (self.state != self.ViewModel.TextValue()) { self.state = self.ViewModel.TextValue() args = self.parameters.post_service args["value"] = self.state self.call_service(self, args) } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function OnStateAvailable(self, state)\n {\n self.set_field(self, \"state\", self.map_state(self, state.state))\n }", "function OnStateAvailable(self, state)\n {\n self.set_field(self, \"state\", self.map_state(self, state.state))\n }", "function OnStateAvailable(self, state)\n {\n...
[ "0.73263496", "0.73263496", "0.69666564", "0.69666564", "0.69666564", "0.69666564", "0.69242686", "0.67867565", "0.6622723", "0.65812755", "0.65421313", "0.64862347", "0.64862347", "0.64862347", "0.6309391", "0.61906636", "0.6169924", "0.61518246", "0.6123605", "0.5981676", "...
0.0
-1
Function Definitions The StateAvailable function will be called when self.state[] has valid information for the requested entity state is the initial state Methods
function OnStateAvailable(self, state) { self.set_field(self, "state", self.map_state(self, state.state)) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function OnStateAvailable(self, state)\n {\n set_value(self, state)\n }", "function OnStateAvailable(self, state)\n {\n set_value(self, state)\n }", "function OnStateAvailable(self, state)\n {\n set_value(self, state)\n }", "function OnStateAvailable(self, state)\n {...
[ "0.69686985", "0.69686985", "0.69686985", "0.69686985", "0.69259375", "0.67887646", "0.6624645", "0.6582675", "0.6543231", "0.64882874", "0.64882874", "0.64882874", "0.6310826", "0.61924905", "0.61697924", "0.6152262", "0.61256355", "0.59825474", "0.59825474", "0.59441656", "...
0.73284537
1
Function Definitions The StateAvailable function will be called when self.state[] has valid information for the requested entity state is the initial state
function OnStateAvailable(self, state) { self.state = state.state; set_view(self, self.state) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function OnStateAvailable(self, state)\n {\n self.set_field(self, \"state\", self.map_state(self, state.state))\n }", "function OnStateAvailable(self, state)\n {\n self.set_field(self, \"state\", self.map_state(self, state.state))\n }", "function OnStateAvailable(self, state)\n {\n...
[ "0.7310421", "0.7310421", "0.69752914", "0.69752914", "0.69752914", "0.69752914", "0.6930684", "0.6647277", "0.65827876", "0.6552943", "0.64757675", "0.62965363", "0.61546206", "0.61418915", "0.60739774", "0.60511327", "0.6046045", "0.5944369", "0.5944369", "0.5784949", "0.57...
0.64265186
12
The OnStateUpdate function will be called when the specific entity receives a state update its new values will be available in self.state[] and returned in the state parameter
function OnStateUpdate(self, state) { if (!("ignore_state" in self.parameters) || self.parameters.ignore_state === 0) { self.state = state.state; set_view(self, self.state) } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "handleUpdatedState(state) {\n this.lastTechnology = state.selectedTechnology;\n this.totalClicks = state.clickCounter;\n }", "updateState() {\n\t\tthis.trigger(this.state);\n\t}", "stateUpdate() {\n this.handlestateVariable();\n this.handlestateVariable2();\n this.handleCChange(...
[ "0.7009249", "0.6854143", "0.6796559", "0.67764664", "0.6762307", "0.6726108", "0.6551494", "0.6517411", "0.6496623", "0.6496623", "0.6473126", "0.6460814", "0.6446271", "0.6438854", "0.6411804", "0.641117", "0.632063", "0.63070124", "0.63041973", "0.63024896", "0.6285687", ...
0.6545107
7
Set view is a helper function to set all aspects of the widget to its current state it is called by widget code when an update occurs or some other event that requires a an update of the view
function set_view(self, state, level) { if (state === self.parameters.state_active || ("active_map" in self.parameters && self.parameters.active_map.includes(state))) { self.set_icon(self, "icon", self.icons.icon_on); self.set_field(self, "icon_style", self.css.icon_style_active) } else { self.set_icon(self, "icon", self.icons.icon_off); self.set_field(self, "icon_style", self.css.icon_style_inactive) } if ("state_text" in self.parameters && self.parameters.state_text === 1) { self.set_field(self, "state_text", self.map_state(self, state)) } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function OnStateUpdate(self, state)\n {\n set_view(self, state)\n }", "function OnStateUpdate(self, state)\n {\n set_view(self, state)\n }", "function OnStateUpdate(self, state)\n {\n set_view(self, state)\n }", "function setView(newState) {\r\n _updateView(null,...
[ "0.7733251", "0.7733251", "0.7733251", "0.77318", "0.72683024", "0.70956314", "0.7093537", "0.7048044", "0.6952537", "0.6938064", "0.679264", "0.675826", "0.6750861", "0.6725923", "0.66904855", "0.66389334", "0.6533543", "0.6526951", "0.65169847", "0.6506038", "0.64756083", ...
0.6245171
29
Function Definitions The StateAvailable function will be called when self.state[] has valid information for the requested entity state is the initial state
function OnStateAvailable(self, state) { self.entity = state.entity_id; self.level = state.attributes.volume_level; set_view(self, state) if ("dump_capabilities" in self.parameters && self.parameters["dump_capabilities"] == "1") { display_supported_functions(self) } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function OnStateAvailable(self, state)\n {\n self.set_field(self, \"state\", self.map_state(self, state.state))\n }", "function OnStateAvailable(self, state)\n {\n self.set_field(self, \"state\", self.map_state(self, state.state))\n }", "function OnStateAvailable(self, state)\n {\n...
[ "0.73103726", "0.73103726", "0.69755137", "0.69755137", "0.69755137", "0.69755137", "0.693129", "0.6648063", "0.65828377", "0.65529156", "0.64256227", "0.64256227", "0.64256227", "0.6296636", "0.6154816", "0.6140548", "0.60751325", "0.60498303", "0.60464376", "0.594488", "0.5...
0.6476712
10
The OnStateUpdate function will be called when the specific entity receives a state update its new values will be available in self.state[] and returned in the state parameter
function OnStateUpdate(self, state) { self.level = state.attributes.volume_level; set_view(self, state) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "handleUpdatedState(state) {\n this.lastTechnology = state.selectedTechnology;\n this.totalClicks = state.clickCounter;\n }", "updateState() {\n\t\tthis.trigger(this.state);\n\t}", "stateUpdate() {\n this.handlestateVariable();\n this.handlestateVariable2();\n this.handleCChange(...
[ "0.70077926", "0.6852809", "0.6795396", "0.6775392", "0.67612934", "0.6724651", "0.6551379", "0.65442294", "0.6517035", "0.6495464", "0.6495464", "0.64726466", "0.64598566", "0.6443647", "0.6438235", "0.64101493", "0.64096826", "0.631815", "0.6304705", "0.6301794", "0.629913"...
0.0
-1
Function Definitions The StateAvailable function will be called when self.state[] has valid information for the requested entity state is the initial state Methods
function OnStateAvailable(self, state) { self.min = state.attributes.min self.max = state.attributes.max self.step = state.attributes.step self.level = state.state if ("units" in self.parameters) { self.set_field(self, "unit", self.parameters.units) } set_view(self, state) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function OnStateAvailable(self, state)\n {\n self.set_field(self, \"state\", self.map_state(self, state.state))\n }", "function OnStateAvailable(self, state)\n {\n self.set_field(self, \"state\", self.map_state(self, state.state))\n }", "function OnStateAvailable(self, state)\n {\n...
[ "0.73287344", "0.73287344", "0.6968565", "0.6968565", "0.6968565", "0.6968565", "0.6926128", "0.6789413", "0.66253674", "0.65430224", "0.64888936", "0.64888936", "0.64888936", "0.6310257", "0.6190595", "0.61709887", "0.6154469", "0.6125979", "0.5983027", "0.5983027", "0.59440...
0.6582287
9
Function Definitions The StateAvailable function will be called when self.state[] has valid information for the requested entity state is the initial state Methods
function OnStateAvailable(self, state) { drawChart(self, state) set_value(self, state) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function OnStateAvailable(self, state)\n {\n self.set_field(self, \"state\", self.map_state(self, state.state))\n }", "function OnStateAvailable(self, state)\n {\n self.set_field(self, \"state\", self.map_state(self, state.state))\n }", "function OnStateAvailable(self, state)\n {\n...
[ "0.73263496", "0.73263496", "0.69666564", "0.69666564", "0.69666564", "0.69666564", "0.69242686", "0.67867565", "0.6622723", "0.65812755", "0.65421313", "0.64862347", "0.64862347", "0.64862347", "0.6309391", "0.61906636", "0.6169924", "0.61518246", "0.6123605", "0.5981676", "...
0.5811763
24
Function Definitions The StateAvailable function will be called when self.state[] has valid information for the requested entity state is the initial state
function OnStateAvailable(self, state) { self.state = state.state; self.access_token = state.attributes.access_token refresh_frame(self) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function OnStateAvailable(self, state)\n {\n self.set_field(self, \"state\", self.map_state(self, state.state))\n }", "function OnStateAvailable(self, state)\n {\n self.set_field(self, \"state\", self.map_state(self, state.state))\n }", "function OnStateAvailable(self, state)\n {\n...
[ "0.73103726", "0.73103726", "0.69755137", "0.69755137", "0.69755137", "0.69755137", "0.693129", "0.6648063", "0.65828377", "0.65529156", "0.6476712", "0.64256227", "0.64256227", "0.64256227", "0.6296636", "0.6154816", "0.6140548", "0.60751325", "0.60498303", "0.60464376", "0....
0.57846725
22
The OnStateUpdate function will be called when the specific entity receives a state update its new values will be available in self.state[] and returned in the state parameter
function OnStateUpdate(self, state) { self.state = state.state; self.access_token = state.attributes.access_token refresh_frame(self) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "handleUpdatedState(state) {\n this.lastTechnology = state.selectedTechnology;\n this.totalClicks = state.clickCounter;\n }", "updateState() {\n\t\tthis.trigger(this.state);\n\t}", "stateUpdate() {\n this.handlestateVariable();\n this.handlestateVariable2();\n this.handleCChange(...
[ "0.70077926", "0.6852809", "0.6795396", "0.6775392", "0.67612934", "0.6724651", "0.6551379", "0.65442294", "0.6517035", "0.6495464", "0.6495464", "0.64726466", "0.64598566", "0.6443647", "0.6438235", "0.64101493", "0.64096826", "0.631815", "0.6304705", "0.6301794", "0.629913"...
0.0
-1
Function Definitions The StateAvailable function will be called when self.state[] has valid information for the requested entity state is the initial state Methods
function OnStateAvailable(self, state) { self.state = state.state self.minvalue = state.attributes.min self.maxvalue = state.attributes.max self.stepvalue = state.attributes.step set_options(self, self.minvalue, self.maxvalue, self.stepvalue, state) set_value(self, state) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function OnStateAvailable(self, state)\n {\n self.set_field(self, \"state\", self.map_state(self, state.state))\n }", "function OnStateAvailable(self, state)\n {\n self.set_field(self, \"state\", self.map_state(self, state.state))\n }", "function OnStateAvailable(self, state)\n {\n...
[ "0.73287344", "0.73287344", "0.6968565", "0.6968565", "0.6968565", "0.6968565", "0.6926128", "0.6789413", "0.66253674", "0.6582287", "0.64888936", "0.64888936", "0.64888936", "0.6310257", "0.6190595", "0.61709887", "0.6154469", "0.6125979", "0.5983027", "0.5983027", "0.594407...
0.65430224
10
Function Definitions The StateAvailable function will be called when self.state[] has valid information for the requested entity state is the initial state Methods
function OnStateAvailable(self, state) { set_value(self, state) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function OnStateAvailable(self, state)\n {\n self.set_field(self, \"state\", self.map_state(self, state.state))\n }", "function OnStateAvailable(self, state)\n {\n self.set_field(self, \"state\", self.map_state(self, state.state))\n }", "function OnStateAvailable(self, state)\n {\n...
[ "0.73263496", "0.73263496", "0.69242686", "0.67867565", "0.6622723", "0.65812755", "0.65421313", "0.64862347", "0.64862347", "0.64862347", "0.6309391", "0.61906636", "0.6169924", "0.61518246", "0.6123605", "0.5981676", "0.5981676", "0.59421873", "0.5932553", "0.5869572", "0.5...
0.69666564
3
Function Definitions The StateAvailable function will be called when self.state[] has valid information for the requested entity state is the initial state Methods
function OnStateAvailable(self, state) { set_value(self, state) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function OnStateAvailable(self, state)\n {\n self.set_field(self, \"state\", self.map_state(self, state.state))\n }", "function OnStateAvailable(self, state)\n {\n self.set_field(self, \"state\", self.map_state(self, state.state))\n }", "function OnStateAvailable(self, state)\n {\n...
[ "0.73284537", "0.73284537", "0.69259375", "0.67887646", "0.6624645", "0.6582675", "0.6543231", "0.64882874", "0.64882874", "0.64882874", "0.6310826", "0.61924905", "0.61697924", "0.6152262", "0.61256355", "0.59825474", "0.59825474", "0.59441656", "0.59334165", "0.58703524", "...
0.69686985
4
Function Definitions The StateAvailable function will be called when self.state[] has valid information for the requested entity state is the initial state
function OnStateAvailable(self, state) { self.state = state.state; set_view(self, self.state) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function OnStateAvailable(self, state)\n {\n self.set_field(self, \"state\", self.map_state(self, state.state))\n }", "function OnStateAvailable(self, state)\n {\n self.set_field(self, \"state\", self.map_state(self, state.state))\n }", "function OnStateAvailable(self, state)\n {\n...
[ "0.7310421", "0.7310421", "0.69752914", "0.69752914", "0.69752914", "0.69752914", "0.6930684", "0.6647277", "0.65827876", "0.6552943", "0.64757675", "0.62965363", "0.61546206", "0.61418915", "0.60739774", "0.60511327", "0.6046045", "0.5944369", "0.5944369", "0.5784949", "0.57...
0.64265186
13
The OnStateUpdate function will be called when the specific entity receives a state update its new values will be available in self.state[] and returned in the state parameter
function OnStateUpdate(self, state) { self.state = state.state; set_view(self, self.state) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "handleUpdatedState(state) {\n this.lastTechnology = state.selectedTechnology;\n this.totalClicks = state.clickCounter;\n }", "updateState() {\n\t\tthis.trigger(this.state);\n\t}", "stateUpdate() {\n this.handlestateVariable();\n this.handlestateVariable2();\n this.handleCChange(...
[ "0.7009249", "0.6854143", "0.6796559", "0.67764664", "0.6726108", "0.6551494", "0.6545107", "0.6517411", "0.6496623", "0.6496623", "0.6473126", "0.6460814", "0.6446271", "0.6438854", "0.6411804", "0.641117", "0.632063", "0.63070124", "0.63041973", "0.63024896", "0.6285687", ...
0.6762307
4
Set view is a helper function to set all aspects of the widget to its current state it is called by widget code when an update occurs or some other event that requires a an update of the view
function set_view(self, state, level) { if ("icons" in self.parameters) { if (state in self.parameters.icons) { self.set_icon(self, "icon", self.parameters.icons[state].icon); self.set_field(self, "icon_style", self.parameters.icons[state].style) } else if ("default" in self.parameters.icons) { self.set_icon(self, "icon", self.parameters.icons.default.icon); self.set_field(self, "icon_style", self.parameters.icons.default.style) } else { self.set_icon(self, "icon", "fa-circle-thin"); self.set_field(self, "icon_style", "color: white") } } if ("state_text" in self.parameters && self.parameters.state_text == 1) { self.set_field(self, "state_text", self.map_state(self, state)) } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function OnStateUpdate(self, state)\n {\n set_view(self, state)\n }", "function OnStateUpdate(self, state)\n {\n set_view(self, state)\n }", "function OnStateUpdate(self, state)\n {\n set_view(self, state)\n }", "function setView(newState) {\r\n _updateView(null,...
[ "0.7733251", "0.7733251", "0.7733251", "0.77318", "0.72683024", "0.70956314", "0.7093537", "0.7048044", "0.6952537", "0.6938064", "0.679264", "0.675826", "0.6750861", "0.6725923", "0.66904855", "0.66389334", "0.6533543", "0.6526951", "0.65169847", "0.6506038", "0.64756083", ...
0.61747974
34
The OnStateUpdate function will be called when the specific entity receives a state update its new values will be available in self.state[] and returned in the state parameter
function OnStateUpdate(self, state) { set_view(self, state) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "handleUpdatedState(state) {\n this.lastTechnology = state.selectedTechnology;\n this.totalClicks = state.clickCounter;\n }", "updateState() {\n\t\tthis.trigger(this.state);\n\t}", "stateUpdate() {\n this.handlestateVariable();\n this.handlestateVariable2();\n this.handleCChange(...
[ "0.7009522", "0.6854083", "0.679671", "0.6775288", "0.67625326", "0.67257464", "0.65530324", "0.65453386", "0.6517903", "0.64969283", "0.64969283", "0.6472901", "0.6461478", "0.6445605", "0.6439849", "0.6411765", "0.64113086", "0.6320047", "0.6305521", "0.6303993", "0.6301197...
0.6093604
39
If forecast is disabled don't monitor the forecast sensors
function check_if_forecast_sensor(show_forecast, entity) { if (show_forecast) { return true } else if(entity.substring(entity.length - 2) === "_1") { return false } else { return true } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function tryStopMonitoringSensors() {\n if (statusOn === true) {\n stopMonitoringPrompt();\n }\n}", "function uponEStopDisabled() {\n\tif (feedholdActivated == true) {\n\t\tsocket.emit('write', options.port, \"~\")\n\t\tclearInterval(feedHoldTimer);\n\t\tbuttonLED.writeSync(0);\n\t\tconsole.log(\"RE...
[ "0.6020743", "0.5971603", "0.594338", "0.5810529", "0.5806425", "0.5798015", "0.5741471", "0.57410043", "0.57284427", "0.56932485", "0.5642147", "0.5587132", "0.55635566", "0.5557027", "0.5530844", "0.5482341", "0.5441158", "0.54361045", "0.5406808", "0.53965837", "0.5382067"...
0.5816751
4
Function Definitions The OnStateAvailable function will be called when self.state[] has valid information for the requested entity state is the initial state Methods
function OnStateUpdate(self, state) { set_view(self, state) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function OnStateAvailable(self, state)\n {\n self.set_field(self, \"state\", self.map_state(self, state.state))\n }", "function OnStateAvailable(self, state)\n {\n self.set_field(self, \"state\", self.map_state(self, state.state))\n }", "function OnStateAvailable(self, state)\n {\n...
[ "0.7704675", "0.7704675", "0.73346126", "0.73346126", "0.73346126", "0.73346126", "0.72721875", "0.7176626", "0.7009106", "0.6889444", "0.6889444", "0.6889444", "0.6869495", "0.67982274", "0.67252123", "0.6632525", "0.6394417", "0.6394417", "0.63082206", "0.6292552", "0.61473...
0.0
-1
Function Definitions The StateAvailable function will be called when self.state[] has valid information for the requested entity state is the initial state Methods
function OnStateAvailable(self, state) { activateChart(self, state) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function OnStateAvailable(self, state)\n {\n self.set_field(self, \"state\", self.map_state(self, state.state))\n }", "function OnStateAvailable(self, state)\n {\n self.set_field(self, \"state\", self.map_state(self, state.state))\n }", "function OnStateAvailable(self, state)\n {\n...
[ "0.73263496", "0.73263496", "0.69666564", "0.69666564", "0.69666564", "0.69666564", "0.69242686", "0.67867565", "0.6622723", "0.65812755", "0.65421313", "0.64862347", "0.64862347", "0.64862347", "0.6309391", "0.61906636", "0.6169924", "0.61518246", "0.6123605", "0.59421873", ...
0.5981676
20
Function Definitions The StateAvailable function will be called when self.state[] has valid information for the requested entity state is the initial state Methods
function OnStateAvailable(self, state) { set_value(self, state) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function OnStateAvailable(self, state)\n {\n self.set_field(self, \"state\", self.map_state(self, state.state))\n }", "function OnStateAvailable(self, state)\n {\n self.set_field(self, \"state\", self.map_state(self, state.state))\n }", "function OnStateAvailable(self, state)\n {\n...
[ "0.73284537", "0.73284537", "0.69259375", "0.67887646", "0.6624645", "0.6582675", "0.6543231", "0.64882874", "0.64882874", "0.64882874", "0.6310826", "0.61924905", "0.61697924", "0.6152262", "0.61256355", "0.59825474", "0.59825474", "0.59441656", "0.59334165", "0.58703524", "...
0.69686985
5
Function Definitions The StateAvailable function will be called when self.state[] has valid information for the requested entity state is the initial state Methods
function OnChange(self, state) { date = self.ViewModel.DateValue() time = self.ViewModel.TimeValue() args = self.parameters.post_service if (self.has_date && self.has_time) { args["datetime"] = self.state datetime = new Date(self.state); args["date"] = date; args["time"] = time; } else if (self.has_date) { args["date"] = date; } else { args["time"] = time; } self.call_service(self, args); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function OnStateAvailable(self, state)\n {\n self.set_field(self, \"state\", self.map_state(self, state.state))\n }", "function OnStateAvailable(self, state)\n {\n self.set_field(self, \"state\", self.map_state(self, state.state))\n }", "function OnStateAvailable(self, state)\n {\n...
[ "0.73274463", "0.73274463", "0.6967985", "0.6967985", "0.6967985", "0.6967985", "0.6925284", "0.6787534", "0.6623425", "0.6582334", "0.6542602", "0.64877796", "0.64877796", "0.64877796", "0.6310058", "0.619203", "0.6170058", "0.6153031", "0.61245376", "0.59818846", "0.5981884...
0.0
-1
Function Definitions The StateAvailable function will be called when self.state[] has valid information for the requested entity state is the initial state
function OnStateAvailable(self, state) { self.state = state.state; if ("brightness" in state.attributes) { self.level = state.attributes.brightness } else { self.level = 0 } set_view(self, self.state, self.level) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function OnStateAvailable(self, state)\n {\n self.set_field(self, \"state\", self.map_state(self, state.state))\n }", "function OnStateAvailable(self, state)\n {\n self.set_field(self, \"state\", self.map_state(self, state.state))\n }", "function OnStateAvailable(self, state)\n {\n...
[ "0.73120666", "0.73120666", "0.6977355", "0.6977355", "0.6977355", "0.6977355", "0.69324744", "0.6648962", "0.65847546", "0.65548795", "0.6477568", "0.64274395", "0.64274395", "0.64274395", "0.6298585", "0.61558354", "0.61416197", "0.60750127", "0.6050499", "0.5945708", "0.59...
0.6047937
19
The OnStateUpdate function will be called when the specific entity receives a state update its new values will be available in self.state[] and returned in the state parameter
function OnStateUpdate(self, state) { self.state = state.state; if ("brightness" in state.attributes) { self.level = state.attributes.brightness } else { self.level = 0 } set_view(self, self.state, self.level) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "handleUpdatedState(state) {\n this.lastTechnology = state.selectedTechnology;\n this.totalClicks = state.clickCounter;\n }", "updateState() {\n\t\tthis.trigger(this.state);\n\t}", "stateUpdate() {\n this.handlestateVariable();\n this.handlestateVariable2();\n this.handleCChange(...
[ "0.7009509", "0.68534744", "0.6797191", "0.6777667", "0.6762109", "0.67258936", "0.6550916", "0.6545304", "0.65175915", "0.6496347", "0.6496347", "0.64727676", "0.6461663", "0.6445238", "0.6439589", "0.64118975", "0.6320825", "0.6306055", "0.6303542", "0.63016874", "0.6285365...
0.64113444
16
Set view is a helper function to set all aspects of the widget to its current state it is called by widget code when an update occurs or some other event that requires a an update of the view
function set_view(self, state, level) { if (state == "on") { // Set Icon will set the style correctly for an icon self.set_icon(self, "icon", self.icons.icon_on) // Set view will set the view for the appropriate field self.set_field(self, "icon_style", self.css.icon_style_active) } else { self.set_icon(self, "icon", self.icons.icon_off) self.set_field(self, "icon_style", self.css.icon_style_inactive) } if (typeof level == 'undefined') { self.set_field(self, "level", 0) } else { self.set_field(self, "level", Math.ceil((level*100/255) / 10) * 10) } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function OnStateUpdate(self, state)\n {\n set_view(self, state)\n }", "function OnStateUpdate(self, state)\n {\n set_view(self, state)\n }", "function OnStateUpdate(self, state)\n {\n set_view(self, state)\n }", "function setView(newState) {\r\n _updateView(null,...
[ "0.77327347", "0.77327347", "0.77327347", "0.7732147", "0.72680503", "0.709593", "0.7092549", "0.70473486", "0.6951931", "0.6936921", "0.67916954", "0.6757068", "0.67498523", "0.6724595", "0.6690341", "0.6637219", "0.6531726", "0.65158796", "0.65054333", "0.64750105", "0.6469...
0.6526113
17
Function Definitions The StateAvailable function will be called when self.state[] has valid information for the requested entity state is the initial state Methods
function OnStateAvailable(self, state) { self.state = state; self.options = state.attributes.options; set_options(self, self.options, state); set_value(self, state) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function OnStateAvailable(self, state)\n {\n self.set_field(self, \"state\", self.map_state(self, state.state))\n }", "function OnStateAvailable(self, state)\n {\n self.set_field(self, \"state\", self.map_state(self, state.state))\n }", "function OnStateAvailable(self, state)\n {\n...
[ "0.73274463", "0.73274463", "0.6967985", "0.6967985", "0.6967985", "0.6967985", "0.6787534", "0.6623425", "0.6582334", "0.6542602", "0.64877796", "0.64877796", "0.64877796", "0.6310058", "0.619203", "0.6170058", "0.6153031", "0.61245376", "0.59818846", "0.59818846", "0.594362...
0.6925284
6
Access the device camera and stream to cameraView
function cameraStart() { if(selfie === true){ cameraView.classList.replace("user", "environment"); cameraOutput.classList.replace("user", "environment"); cameraSensor.classList.replace("user", "environment"); constraints = rearConstraints; selfie = false; } else{ cameraView.classList.replace("environment", "user"); cameraOutput.classList.replace("environment", "user"); cameraSensor.classList.replace("environment", "user"); constraints = userConstraints; selfie = true; } navigator.mediaDevices .getUserMedia(constraints) .then(function(stream) { track = stream.getTracks()[0]; cameraView.srcObject = stream; }) .catch(function(error) { console.error("Oops. Something is broken.", error); }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function cameraStart() {\n cameraView = document.querySelector(\"#webcam\");\n navigator.mediaDevices\n .getUserMedia(constraints)\n .then(function(stream) {\n cameraView.srcObject = stream;\n })\n .catch(function(error) {\n console.error(\"Oops. Something is broken.\", erro...
[ "0.758713", "0.75417554", "0.7541669", "0.75172424", "0.75107795", "0.75107795", "0.7510564", "0.7510564", "0.74429345", "0.73991096", "0.70942545", "0.7090021", "0.6948964", "0.6936582", "0.68981737", "0.6872878", "0.68575525", "0.6816149", "0.67939097", "0.67637664", "0.675...
0.67058706
27
It seems that this function is unused.
function scCloseWebEdit(url) { window.top.returnValue = window.returnValue = url; window.top.close(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private internal function m248() {}", "function noop(){}// No operation performed.", "function noop(){}// No operation performed.", "function noop(){}// No operation performed.", "function noop(){}// No operation performed.", "function noop(){}// No operation performed.", "function noop(){}// No operat...
[ "0.73142385", "0.730672", "0.730672", "0.730672", "0.730672", "0.730672", "0.730672", "0.730672", "0.7191441", "0.71903825", "0.71666676", "0.71666676", "0.71666676", "0.71666676", "0.71666676", "0.71666676", "0.71666676", "0.7122185", "0.710747", "0.71002126", "0.7036951", ...
0.0
-1
copy the user name in the message field
function copy_user_name (user_name) { if (document.post.message) { document.post.message.value += user_name; document.post.message.focus(); } return false; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function copyUsername(event) {\n\tvar hostname = event.target.parentNode.parentNode.firstChild.innerHTML;\n\tvar hypertext = event.target.parentNode.parentNode.childNodes[1].innerHTML;\n\tvar indexOfTerminator = hypertext.indexOf(\">\");\n\tvar username = hypertext.slice(indexOfTerminator + 2);\n\t\n\tif(username)...
[ "0.6916677", "0.6790312", "0.6691315", "0.6661673", "0.66339594", "0.6558485", "0.6458046", "0.6451766", "0.631425", "0.62791485", "0.6261696", "0.62549543", "0.6226268", "0.6226268", "0.6226268", "0.6226268", "0.62220025", "0.61526287", "0.6139581", "0.61363566", "0.6108741"...
0.81362367
0
orders matters Spread is not the deep clone( only shallow copy, one level deep) Cloned Obj or array has the different reference, but the nested obj or array refer to the same
function filterOutOdds(){ var nums =Array.prototype.slice.call(arguments); return nums.filter(function(num){ return num%2===0 }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getClone() {\n // Recursive function to clone Object + Array\n function recClone(oldObject, newObject) {\n Object.keys(oldObject).forEach(function forCurrentParam(key) {\n if (typeof oldObject[key] !== 'function') {\n if (Array.isArray(oldObject[key])) {\n ...
[ "0.7424721", "0.7263164", "0.7134192", "0.69808674", "0.6961201", "0.6952078", "0.6930319", "0.690196", "0.68761724", "0.6828858", "0.6815011", "0.6808319", "0.67657876", "0.67624754", "0.67320687", "0.6713964", "0.6691904", "0.6689389", "0.6689389", "0.6684475", "0.66829324"...
0.0
-1
This component just renders a block graphic. It can be either filled or stroked, and can be one of the specified colors if filled. The component will also expand to fit within it's parent container. COLORS primary brand green js yellow css blue sass pink html red
function Block({ color, blockType, children, }) { return ( <div className={`block-image ${color} ${blockType}`}> <span>{children}</span> <svg viewBox="0 0 87 100" fill="none" xmlns="http://www.w3.org/2000/svg"> <path d="M18.9923 14.4949H20.9923V12.4949V3.49857C20.9923 2.67093 21.6632 2 22.4908 2H64.4737C65.3014 2 65.9723 2.67093 65.9723 3.49857V12.4949V14.4949H67.9723H83.466C84.2936 14.4949 84.9645 15.1658 84.9645 15.9935V95.9609C84.9645 96.7885 84.2936 97.4594 83.466 97.4594H3.49857C2.67093 97.4594 2 96.7885 2 95.9609V15.9935C2 15.1658 2.67093 14.4949 3.49857 14.4949H18.9923Z"/> </svg> </div> ); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function create_if_block_4$2(ctx) {\n\t\tlet colorblock;\n\t\tlet current;\n\n\t\tcolorblock = new Color({\n\t\t\t\tprops: {\n\t\t\t\t\ticons: /*icons*/ ctx[0],\n\t\t\t\t\tvalue: /*customisations*/ ctx[1].color,\n\t\t\t\t\tcustomise: /*customise*/ ctx[2]\n\t\t\t\t}\n\t\t\t});\n\n\t\treturn {\n\t\t\tc() {\n\t\t\t\t...
[ "0.6361312", "0.5987676", "0.581662", "0.57904655", "0.5784455", "0.5740217", "0.57270694", "0.5724484", "0.5722077", "0.572059", "0.5704862", "0.56403375", "0.5615856", "0.5605422", "0.5602084", "0.558966", "0.55469525", "0.5534835", "0.5504273", "0.54880357", "0.548695", ...
0.63270795
1
Returns model related to current route.
model(params) { const store = this.get('store'); let arrRec = []; for (let i = 1; i < 10; i++) { let newRecord = store.createRecord('components-examples/flexberry-groupedit/shared/detail', { text: i + 'test', flag: i % 2, }); arrRec.push(newRecord); } // Aggregator with details. const aggregator = store.createRecord('components-examples/flexberry-groupedit/shared/aggregator', { details: arrRec }); return aggregator; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "getCurrentModel() {\n\t\t\t\treturn this.findWhere({isHidden: false});\n\t\t\t}", "function routeModel(routeInfo) {\n if (routeInfo && !routeInfo.hasOwnProperty('_lf_model')) {\n let r, c;\n if ((r = routeInfo.render) && (c = r.controller)) {\n routeInfo._lf_model = Ember.get(c, 'model');\n ...
[ "0.5968437", "0.5880773", "0.5715209", "0.57039857", "0.5493627", "0.54518324", "0.54364693", "0.5408597", "0.53452957", "0.53452957", "0.53452957", "0.53443533", "0.53436327", "0.53436327", "0.53436327", "0.53436327", "0.53436327", "0.5287727", "0.5287012", "0.5245083", "0.5...
0.0
-1
create noteBookStarts this function adds a button with calls to add new note books
function createAddNoteBookButton() { let getDropdownMenu = document.getElementsByClassName("dropdown-menu")[0]; let flexBoxForContent = document.createElement("div"); let buttonToAddBooks = document.createElement("button"); let buttonImage = document.createElement("img"); let formToInput = document.createElement("form"); let noteBookNameInput = document.createElement("input"); flexBoxForContent.className = " addNoteBookFlexBox"; buttonToAddBooks.className = "addNoteBookButton"; noteBookNameInput.className = "noteBookTitle"; buttonImage.src = "/media/plus-circle.svg"; noteBookNameInput.placeholder = "Title of book"; noteBookNameInput.required = true; noteBookNameInput.addEventListener("keypress", function (event) { let e = event; if (e.code === "Enter") { createNoteBook(); } }); getDropdownMenu.appendChild(flexBoxForContent); buttonToAddBooks.appendChild(buttonImage); flexBoxForContent.appendChild(buttonToAddBooks); flexBoxForContent.appendChild(formToInput); formToInput.appendChild(noteBookNameInput); buttonToAddBooks.addEventListener("click", function () { createNoteBook(); }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function addNoteButton(note) {\n var li = $(\"<div />\", slide.contentDocument);\n li.addClass(\"noteButton\");\n var time = $(\"<div />\", slide.contentDocument);\n time.addClass(\"noteButtonTime\");\n time.text(new Date(note.time).toLocaleString());\n li.append(time);\n var sum...
[ "0.6616951", "0.66157573", "0.63582593", "0.6181226", "0.608733", "0.60573596", "0.60441613", "0.60151213", "0.5942763", "0.58742195", "0.5861623", "0.5835648", "0.5807749", "0.5805397", "0.5793124", "0.57873636", "0.57800484", "0.5769079", "0.57638675", "0.57594925", "0.5738...
0.6322221
3
Calls all functions necessary for creating a new notebook
function createNoteBook(inputFromLocalStorage) { let inputTitle = document.getElementsByClassName("noteBookTitle")[0].value; if (inputFromLocalStorage != null) { inputTitle = inputFromLocalStorage; } let changeInputBoxApparance = document.getElementsByClassName( "noteBookTitle" )[0]; if (inputTitle === "") { changeInputBoxApparance.style.border = "solid red 3px"; } else { changeInputBoxApparance.style.border = "solid 1px"; existingNoteBooks.push(new NoteBookObject(inputTitle)); document.getElementsByClassName("noteBookTitle")[0].value = ""; } updateCurrentNoteBooks(); saveNoteBooksToLocalStorage(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function addNewNotebook()\n{\n var ui = DocumentApp.getUi();\n ui.alert(\"To create a notebook, we're going to need the following settings:\\n\" +\n \" + short title \\n\" +\n \" + long title (Optional. Default is to copy the short title's value over) \\n\" +\n \" + pick the directo...
[ "0.74541605", "0.6817608", "0.6796423", "0.6675822", "0.633511", "0.62706137", "0.6207379", "0.6046958", "0.5970958", "0.5946117", "0.5934344", "0.5774889", "0.5720692", "0.5705702", "0.5653792", "0.5653258", "0.5642841", "0.55845636", "0.5442661", "0.5429757", "0.53689176", ...
0.0
-1
function to take all current Notebooks and save to local storage
function saveNoteBooksToLocalStorage() { if (existingNoteBooks.length > 1) { let arrayToHoldAllCurrentNotebooks = []; existingNoteBooks.forEach((element) => { if (element.titleOfObject != "Dashboard") { arrayToHoldAllCurrentNotebooks.push(element.titleOfObject); } }); //need to clear array after used or check before if there allredy is a existing name arrayToHoldAllCurrentNotebooks.toString(); // turns the notes ti string localStorage.setItem("books", arrayToHoldAllCurrentNotebooks); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function createNoteBooksFromLocalStorage() {\n if (localStorage.getItem(\"lastVisitedNoteBook\" != null)) {\n openNotebook = localStorage.getItem(\"lastVisitedNoteBook\");\n }\n if (getLocalStorageListsToArray(\"books\") != null) {\n getLocalStorageListsToArray(\"books\").forEach((element) => {\n cre...
[ "0.65160733", "0.6239477", "0.62268156", "0.62231404", "0.61653936", "0.6035522", "0.5950513", "0.58848053", "0.58633924", "0.5826095", "0.5789223", "0.57411593", "0.5720446", "0.571777", "0.5661546", "0.5654807", "0.5635773", "0.56218225", "0.562086", "0.5620341", "0.5612051...
0.6657014
0
Creates Notebooks from local storage
function createNoteBooksFromLocalStorage() { if (localStorage.getItem("lastVisitedNoteBook" != null)) { openNotebook = localStorage.getItem("lastVisitedNoteBook"); } if (getLocalStorageListsToArray("books") != null) { getLocalStorageListsToArray("books").forEach((element) => { createNoteBook(element); }); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function addNewNotebook()\n{\n var ui = DocumentApp.getUi();\n ui.alert(\"To create a notebook, we're going to need the following settings:\\n\" +\n \" + short title \\n\" +\n \" + long title (Optional. Default is to copy the short title's value over) \\n\" +\n \" + pick the directo...
[ "0.65535074", "0.6126391", "0.60171485", "0.5961831", "0.5856295", "0.5819045", "0.57054645", "0.56985366", "0.55934054", "0.5514346", "0.54395777", "0.538512", "0.51832384", "0.5148144", "0.5105439", "0.50189173", "0.49951193", "0.49883106", "0.49708137", "0.49479792", "0.49...
0.6946914
0
saves which note book was last opened to local storage
function lastVisitedNoteBook(lastNoteBookClick) { //at sstart localStorage.setItem("lastVisitedNoteBook", lastNoteBookClick); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function saveNotes() {\n localStorage.setItem(\"notes\", JSON.stringify(notes));\n localStorage.setItem(\"notesLength\", c);\n}", "function saveNoteBooksToLocalStorage() {\n \n if (existingNoteBooks.length > 1) {\n let arrayToHoldAllCurrentNotebooks = []; \n existingNoteBooks.forEach((element) => {\n ...
[ "0.6889759", "0.6830773", "0.6721873", "0.665003", "0.6529996", "0.64651877", "0.6408103", "0.63371915", "0.63097274", "0.6290464", "0.6288387", "0.6253941", "0.62266415", "0.6226308", "0.6210228", "0.6207492", "0.6185355", "0.61621946", "0.61540675", "0.6145155", "0.61446375...
0.77963895
0
constructor for creating noteBooks
function NoteBookObject(title) { this.titleOfObject = title; this.getTitle = function () { return this.titleOfObject; }; this.setTitle = function (newTitle) { this.titleOfObject = newTitle; }; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "constructor(notes) {\n this.notes = notes\n }", "constructor(title, author, isbn) {\n this.title = title;\n this.author = author;\n this.isbn = isbn;\n }", "constructor(books){\n\t\tsuper();\n\t\tthis.books = books;\n\t}", "constructor(title, author, isbn) {\n this.title = title;\n...
[ "0.67296696", "0.67226857", "0.6698989", "0.6678348", "0.6586897", "0.6563157", "0.65227896", "0.64830065", "0.6471895", "0.647033", "0.6464934", "0.6464934", "0.6464934", "0.6464934", "0.6464934", "0.6458011", "0.6434612", "0.64255077", "0.6409026", "0.63710326", "0.6358817"...
0.5693161
87
Removes note books from local storage
function removeNoteBooks(titleToRemove) { //titleToRemove is a button event bound to the object when created for (let i = 0; i < existingNoteBooks.length; i++) { if (existingNoteBooks[i].titleOfObject == titleToRemove.titleOfObject) { existingNoteBooks.splice(i, 1); if (existingNoteBooks.length == 1) { localStorage.removeItem("books"); //Testar om bara dashboard är kvar och tar bort nyckeln helt. } saveNotesToLocalStorage(); saveNoteBooksToLocalStorage(); break; } } updateCurrentNoteBooks(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "static removeBooks(isbn){\n const books=Store.getBooks();\n books.forEach((book , index) => {\n if(book.isbn === isbn){\n books.splice(index,1);\n }\n });\n //update the books in local storage\n localStorage.setItem('books',JSON.stringify(book...
[ "0.7614057", "0.7548996", "0.7539149", "0.75125355", "0.7499487", "0.74971914", "0.7491167", "0.7463461", "0.7460967", "0.74545836", "0.7412193", "0.73900247", "0.73579043", "0.7330843", "0.73178744", "0.7250102", "0.71605545", "0.711475", "0.71110004", "0.7109582", "0.708979...
0.7851707
0
updates notebooks when somthing is changed
function updateCurrentNoteBooks() { document.querySelectorAll(".dropdown-item").forEach((e) => e.remove()); //cleares window document.querySelectorAll(".noteBookFlex").forEach((e) => e.remove()); //cleares window let getDropdownMenu = document.getElementsByClassName("dropdown-menu")[0]; existingNoteBooks.forEach((element) => { let flexBox = document.createElement("div"); let removeNoteBookButton = document.createElement("button"); let buttonImage = document.createElement("img"); let notebook = document.createElement("button"); // makes the entie title a button flexBox.className = "noteBookFlex"; notebook.className = "dropdown-item"; removeNoteBookButton.className = "removeNoteBookButton"; buttonImage.src = "media/x.svg"; notebook.textContent = element.getTitle(); //gets the title variable in noteBookObject notebook.style.fontFamily = "Cursive"; getDropdownMenu.appendChild(flexBox); removeNoteBookButton.appendChild(buttonImage); if (element.titleOfObject != "Dashboard") { //checks if element is Dashboard so it wont get removed flexBox.appendChild(removeNoteBookButton); } else { notebook.classList.add("Dashboard"); } flexBox.appendChild(notebook); notebook.addEventListener("click", function () { // used to call a certain book to display its notes openNotebook = element.titleOfObject; lastVisitedNoteBook(element.titleOfObject); displayCurrentNoteBook(); globalUpdate(); }); removeNoteBookButton.addEventListener("click", function () { moveToDashboard(element); if (element.titleOfObject == openNotebook) { openNotebook = "Dashboard"; localStorage.setItem("lastVisitedNoteBook", "Dashboard"); } removeNoteBooks(element); displayCurrentNoteBook(); globalUpdate(); }); }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "updated(){\n console.log('Updated');\n }", "updated() {}", "withChanges(changes) {\n let modified = changes.modified || this.modified\n Object.keys(changes).forEach(key => {\n if (changes[key] !== this[key]) modified = true;\n })\n return Object.assign(new Noteb...
[ "0.61587936", "0.5940111", "0.5899971", "0.5836267", "0.574683", "0.5612497", "0.5570089", "0.5567575", "0.5565711", "0.5493417", "0.5491623", "0.54765266", "0.54514295", "0.54513997", "0.54286563", "0.53984255", "0.53809714", "0.53667855", "0.5365714", "0.5354447", "0.532722...
0.0
-1
Changes title of object to Dashboard if notebook is deleted
function moveToDashboard(obj) { for (let i = 0; i < allNotes.length; i++) { if (allNotes[i].titleOfNoteBook == obj.titleOfObject) { allNotes[i].titleOfNoteBook = "Dashboard"; } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "updateTitle(){ \n let title = '';\n const { head, instance } = this.entry;\n\n if (head.hasOwnProperty('title')){\n let prop = head.title;\n\n title = head.title\n if (typeof prop === 'function'){\n title = head.title.apply(instance);\n }\n }\n\n if (title && title.length...
[ "0.63929546", "0.6212503", "0.6136175", "0.60601646", "0.60380554", "0.5995445", "0.59926015", "0.5987756", "0.5978453", "0.5978453", "0.5978453", "0.5978453", "0.5978453", "0.59587693", "0.59484005", "0.59426606", "0.58999807", "0.5896582", "0.5849805", "0.5833995", "0.58321...
0.656114
0
updates the window to show the correct notes
function globalUpdate() { document.querySelectorAll(".note").forEach((e) => e.remove()); //cleares window moveSelected(false); allNotes.forEach((element) => { if (element.titleOfNoteBook == openNotebook && element.delete != true) { main.prepend(element.noteElement); } }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function update() {\n\t\tUtil.txt.setLibraryBrowser( Util.fs.getLibraries() );\n\t\tUtil.txt.setFileBrowser( Util.fs.getNotes(currentLib) );\n\t\tUtil.txt.setInputText( Util.fs.getNoteContent(currentLib,currentNote) );\n\t}", "function displayNotes(notes) {\n\tvar el = document.getElementById('notes-played');\n\...
[ "0.69537705", "0.6777088", "0.67575276", "0.6704025", "0.6642161", "0.6629163", "0.6580714", "0.65699357", "0.6548809", "0.65239954", "0.65226734", "0.6519642", "0.6507642", "0.63968754", "0.63858116", "0.63771915", "0.6352973", "0.63120097", "0.6306151", "0.62804204", "0.627...
0.67187464
3
removes the noteobject from allnotes that is marked for deletion
function clearDeleted() { for (let i = 0; i < allNotes.length; i++) { if (allNotes[i].delete == true) { allNotes.splice(i, 1); } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "deleteNote(note) {\n this.notes = this.notes.filter(item => item !== note);\n }", "function deleteNote(note) {\n note.remove();\n borderedNote = null;\n}", "function deleteNote(note) {\n setAllNotes(allNotes.filter(item => item !== note));\n const notesDataJson = JSON.stringify(allNot...
[ "0.76089793", "0.7041968", "0.70184743", "0.6996954", "0.695652", "0.691289", "0.6806511", "0.68055725", "0.67943794", "0.6751479", "0.67426074", "0.6738711", "0.6738362", "0.6738325", "0.67322916", "0.6699481", "0.6656864", "0.66460276", "0.660822", "0.66030777", "0.6571621"...
0.7354453
1
Gets the current open notebook and displays it in the header of the page
function displayCurrentNoteBook() { let currentNotebookHeading = document.getElementById("current-notebook"); currentNotebookHeading.innerText = openNotebook.toUpperCase(); newNoteBookIntro(currentNotebookHeading); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function displayNotebook($xmlDoc, xmlData, notebookFullPath) {\n var notebookFileName = getFileName(notebookFullPath, false);\n if ($('#navbar a:contains(' + notebookFileName + ')').length > 0) {\n alert('Notebook \"' + notebookFileName + '\" already opened.');\n }\n else {\n // get the root ...
[ "0.6456809", "0.62782466", "0.6004047", "0.5879495", "0.5603937", "0.54541606", "0.538017", "0.5379227", "0.53348196", "0.532251", "0.5318141", "0.53037447", "0.5293501", "0.52915037", "0.52251756", "0.52216583", "0.52136016", "0.52087945", "0.51802206", "0.51747674", "0.5134...
0.7192698
0
flashes the new notebook name when changing noteBook
function newNoteBookIntro(notebookHeading) { notebookHeading.style.color = "#f7faeb"; notebookHeading.style.transition = "all 0.1s ease-in-out"; notebookHeading.style.transform = "scale(1.1)"; setTimeout(() => { notebookHeading.style.color = "#32292f"; notebookHeading.style.transform = "scale(1)"; }, 100); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function displayCurrentNoteBook() {\n let currentNotebookHeading = document.getElementById(\"current-notebook\");\n currentNotebookHeading.innerText = openNotebook.toUpperCase();\n newNoteBookIntro(currentNotebookHeading);\n}", "function addNewNotebook()\n{\n var ui = DocumentApp.getUi();\n ui.alert(\"To cr...
[ "0.71797764", "0.6752349", "0.6553613", "0.64937544", "0.639407", "0.60809535", "0.6047474", "0.6017998", "0.60169315", "0.5945996", "0.5942281", "0.5926539", "0.59200037", "0.58890426", "0.5882442", "0.57101053", "0.56859577", "0.5651363", "0.5591662", "0.5590272", "0.558453...
0.6006226
9
Creates a button that lets the user choose which type of note to create.
function createNewNoteButton() { noteButton = document.createElement("div"); noteButton.className = "menuIcon"; document.body.appendChild(noteButton); let span = document.createElement("span"); noteButton.appendChild(span); let icon = document.createElement("img"); icon.src = "/media/plus-circle.svg"; icon.width = "50"; icon.height = "50"; span.appendChild(icon); noteButton.addEventListener("click", function () { let menu = document.querySelector(".menuIcon"); menu.classList.toggle("active"); }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function makeNote(note) {\n let noteLi = document.createElement(\"li\")\n noteLi.innerText = note.title\n noteLi.className= 'note-li'\n noteLi.dataset.id = note.id\n noteList.append(noteLi)\n\n //How to crete delete button\n let delBtn = document.createElement(\"button\")\n delBtn.innerText = \"delet...
[ "0.7222623", "0.7120385", "0.6857252", "0.6772915", "0.65991366", "0.65508413", "0.6453268", "0.6397792", "0.6396739", "0.6383935", "0.626317", "0.6256256", "0.61936224", "0.61821014", "0.6176898", "0.6175251", "0.61672544", "0.61396337", "0.6117959", "0.61174834", "0.6114075...
0.6875298
2
what the createNewNoteButton contains
function buttonContent() { let listButtons = document.createElement("ul"); noteButton.appendChild(listButtons); let b1 = document.createElement("li"); let b1img = document.createElement("img"); b1img.src = "/media/card-list.svg"; b1img.height = "50"; b1img.width = "50"; listButtons.appendChild(b1); b1.appendChild(b1img); b1.addEventListener("click", function () { allNotes.push(new Note(2)); saveNotesToLocalStorage(); }); let b2 = document.createElement("li"); let b2img = document.createElement("img"); b2img.src = "/media/card-text.svg"; b2img.width = "50"; b2img.height = "50"; listButtons.appendChild(b2); b2.appendChild(b2img); b2.addEventListener("click", function () { allNotes.push(new Note(1)); saveNotesToLocalStorage(); }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function addButtonClick(){\n\t\tvar note = Note();\n\t\tstorage.push(note);\n\t\tdisplayNotes();\n\n\t}", "function addNoteButton(note) {\n var li = $(\"<div />\", slide.contentDocument);\n li.addClass(\"noteButton\");\n var time = $(\"<div />\", slide.contentDocument);\n time.addClass(\"note...
[ "0.74802536", "0.7381172", "0.70298284", "0.6957023", "0.67358464", "0.67260516", "0.6711176", "0.6699864", "0.66497743", "0.6565031", "0.65247077", "0.6523344", "0.65086484", "0.6491537", "0.6453388", "0.6433864", "0.64294523", "0.6415714", "0.6361737", "0.6357423", "0.63323...
0.6375585
18
constructor of note object
function Note(type) { this.noteType = type; this.date = addDate(); this.titleOfNoteBook = openNotebook; this.addingFromLocalStorage = function ( date, savedNoteBookPlacment, savedTextarea ) { if (date != null) { this.date = date; } if (savedNoteBookPlacment != null) { this.titleOfNoteBook = savedNoteBookPlacment; } else { this.titleOfNoteBook = openNotebook; } if (savedTextarea != "" && type == 1) { this.noteElement.getElementsByClassName( "textArea" )[0].textContent = savedTextarea; } }; this.noteElement = createNote(this, type); main.prepend(this.noteElement); this.checkBox = document.createElement("input"); this.checkBox.type = "checkbox"; this.checkBox.style.display = "none"; this.checkBox.className = "checkbox"; this.noteElement.appendChild(this.checkBox); this.delete = false; this.getNoteLi = function () { if (this.noteType == 2) { let arrayOfInnerText = []; let listItemsArray = this.noteElement.getElementsByClassName( "itemOfList" ); for (let index = 0; index < listItemsArray.length; index++) { arrayOfInnerText.push(listItemsArray[index].innerText); } arrayOfInnerText.toString(); return arrayOfInnerText; } }; //om du kan mata varje string som newNext från local sätter denna dit dom en i taget this.setNewLi = function (newText) { if (this.noteType == 2) { let node = this.noteElement.getElementsByClassName("list"); let listItemContainer = document.createElement("div"); listItemContainer.className = "list-item-container"; let node_li = document.createElement("li"); node_li.contentEditable = "true"; node_li.className = "itemOfList"; let textnode = document.createTextNode(newText); let span = document.createElement("SPAN"); let txt = document.createTextNode("\u00D7"); span.className = "remove-list-item"; span.addEventListener("click", () => { listItemContainer.remove(); saveNotesToLocalStorage(); }); span.appendChild(txt); node_li.appendChild(textnode); listItemContainer.appendChild(node_li); listItemContainer.appendChild(span); node[0].appendChild(listItemContainer); return node; } }; this.getNoteText = function () { if (this.noteType == 1) { return this.noteElement.getElementsByClassName("textArea")[0].textContent; } }; this.setTitleOfNoteBook = (title) => { this.titleOfNoteBook = title; }; this.checkBoxVisible = function (choise) { if (choise == true) { return (this.checkBox.style.display = "block"); } else if (choise == false) { return (this.checkBox.style.display = "none"); } }; this.removeNote = function () { this.noteElement.remove(); this.delete = true; clearDeleted(); saveNotesToLocalStorage(); }; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "constructor(notes) {\n this.notes = notes\n }", "function Note() {\n\tthis.maintype = '';\n\tthis.subtype = '';\n\tthis.text = '';\n\tthis.xml_id = '';\n\tthis.custom = '';\n}", "constructor() {\n\t\tthis.notes = [\n\t\t\t {\n\t\t\t \"title\":\"Test Title\",\n\t\t\t \"text\":\"Test t...
[ "0.7773287", "0.7723429", "0.75902754", "0.7585428", "0.7398693", "0.7291604", "0.72496986", "0.7248947", "0.7127152", "0.7062785", "0.7054271", "0.6993288", "0.6926729", "0.678038", "0.6760654", "0.67363656", "0.6730014", "0.66590065", "0.6652097", "0.6570798", "0.65284616",...
0.0
-1
save notes data to local storage
function saveNotesToLocalStorage() { let holdsLocalStorageNotes = []; allNotes.forEach((element) => { element.getNoteText(); let temporaryVarForTextContent = ""; if (element.getNoteText() != "") { temporaryVarForTextContent = element.getNoteText(); } let liFromObjArray = element.getNoteLi(); holdsLocalStorageNotes.push( element.noteType, element.titleOfNoteBook, element.date, temporaryVarForTextContent ); //fix here if (element.noteType == 2) { liFromObjArray.forEach((element) => { holdsLocalStorageNotes.push(element); }); } holdsLocalStorageNotes.push("//"); }); toString(holdsLocalStorageNotes); localStorage.setItem("notes", holdsLocalStorageNotes); // maby add a call in remove notes to jsut to keep in current }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function saveNotes() {\n localStorage.setItem(\"notes\", JSON.stringify(notes));\n localStorage.setItem(\"notesLength\", c);\n}", "function storeNotes() {\n // Store the note in the localStorage\n localStorage.setItem(\"note\", JSON.stringify(notesArray));\n }", "function saveNotes() {\n // Grab the ...
[ "0.85743403", "0.828072", "0.8183288", "0.7982741", "0.7978456", "0.79653776", "0.7956188", "0.7946575", "0.7693433", "0.7688642", "0.7549182", "0.74813306", "0.7425618", "0.7423588", "0.7372362", "0.73708755", "0.73693156", "0.7294581", "0.7252094", "0.7235003", "0.7226063",...
0.77816063
8
Creates notes when page is loaded from local storage
function makeNotesFromLocalStorage() { let noteBookBelongingToNote = ""; let noteOrListType = ""; let dateOfCreatedNote = ""; let noteTosave = []; const endOfSavedNoteSymbol = "//"; openNotebook = localStorage.getItem("lastVisitedNoteBook"); if (getLocalStorageListsToArray("notes") != null) { getLocalStorageListsToArray("notes").forEach((element) => { // creates notes if (element == endOfSavedNoteSymbol && noteTosave[0] == 1) { noteOrListType = noteTosave[0]; noteBookBelongingToNote = noteTosave[1]; dateOfCreatedNote = noteTosave[2]; let noteTextarea = noteTosave[3]; let temporaryHolderOfNoteObj = new Note(noteOrListType); temporaryHolderOfNoteObj.addingFromLocalStorage( dateOfCreatedNote, noteBookBelongingToNote, noteTextarea ); allNotes.push(temporaryHolderOfNoteObj); noteTosave = []; } if (element == endOfSavedNoteSymbol && noteTosave[0] == 2) { // creates note lists noteOrListType = noteTosave[0]; noteBookBelongingToNote = noteTosave[1]; dateOfCreatedNote = noteTosave[2]; let temporaryHolderOfListObj = new Note(noteOrListType); temporaryHolderOfListObj.addingFromLocalStorage( dateOfCreatedNote, noteBookBelongingToNote, "" ); for (let index = 4; index < noteTosave.length; index++) { temporaryHolderOfListObj.setNewLi(noteTosave[index]); } allNotes.push(temporaryHolderOfListObj); //when fixed sent the rest of array into notes noteTosave = []; } if (element != "//") { noteTosave.push(element); } }); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function loadNotes() {\n if (localStorage.notes != undefined) {\n var contents = JSON.parse(localStorage.getItem(\"notes\"));\n\n for (var i = 0; i < contents.length; i ++) {\n addNote(contents[i]);\n }\n }\n}", "function init(){\n notes = JSON.parse(localStorage.getItem(\"notes\"));\n if(!...
[ "0.82129943", "0.78562784", "0.784719", "0.7787464", "0.7723062", "0.7586761", "0.7538566", "0.7522715", "0.7485392", "0.74191415", "0.734278", "0.73172855", "0.7284797", "0.7248811", "0.72059005", "0.7153956", "0.7108009", "0.71079427", "0.69991094", "0.69782436", "0.6960123...
0.70500124
18
used to get any key values from local storage and converts them to a array
function getLocalStorageListsToArray(key) { if (localStorage.getItem(key) != null) { let arrayToHoldkeyList = localStorage.getItem(key); arrayToHoldkeyList = arrayToHoldkeyList.split(","); return arrayToHoldkeyList; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getAllFromLocalStorage() {\n const val = JSON.parse(localStorage.getItem(LOCALSTORAGE_KEY))\n return val || []\n}", "function getStorage() {\n\n //Create an array that will have key equal to local storage. key being \"keys-#\" value-i\"\n var values = [],\n keys = Object.keys(...
[ "0.7880724", "0.7761596", "0.75399387", "0.74989885", "0.74292475", "0.7304346", "0.71555644", "0.70329624", "0.7028343", "0.6999476", "0.69656897", "0.69495726", "0.6923919", "0.6913866", "0.68931514", "0.689128", "0.6880078", "0.68743753", "0.6857292", "0.6856865", "0.68386...
0.7885563
0
creates article element and calls all functions needed to create a note
function createNote(obj, type ) { let article = document.createElement("article"); article = articleAttributes(article); article.appendChild(createDiv1(obj)); article.appendChild(createDiv2(type, article)); article.appendChild(createBtnConfirm()); return article; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function createNote() {\n //object for wrapper html for note\n var $note = $(\"<p>\");\n //define input field\n var $note_text = $(\".note-input input\");\n //conditional check for input field\n if ($note_text.val() !== \"\") {\n //set content for note\n $note.html($note_text.val());\n /...
[ "0.68710387", "0.6724821", "0.6685581", "0.6683752", "0.654901", "0.6516873", "0.64985716", "0.6458424", "0.6451335", "0.6433407", "0.63533705", "0.63507533", "0.63122886", "0.630761", "0.629974", "0.628593", "0.627859", "0.6274803", "0.6255771", "0.62408084", "0.62273866", ...
0.7406209
0
set attributes to article
function articleAttributes(article) { article.className = "note shadow-sm"; article.id = "note-article"; return article; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function setArticles(){\n\t\t\t// Foreach the article tags\n\t\t\tthisElement.children().each(function(_, node) {\n\t\t\t\tarticles[ _ ] = { };\n\t\t\t\tarticles[ _ ][\"data-cols\"]\t\t=\t(node.getAttribute('data-cols') != null)?node.getAttribute('data-cols'):'3';\n\t\t\t\tarticles[ _ ][\"data-theme\"]\t=\t(node.g...
[ "0.6538193", "0.631075", "0.62744415", "0.6005192", "0.5960833", "0.5943872", "0.59389657", "0.5927844", "0.5927825", "0.5924469", "0.58666223", "0.5759843", "0.5759843", "0.5739936", "0.5725239", "0.5723421", "0.5723421", "0.57205445", "0.57091326", "0.568364", "0.5683276", ...
0.7435575
0
creates a div that holds date , delete and change note book buttons
function createDiv1(obj) { let div1 = document.createElement("div"); div1.className = "note-buttons-top"; div1.appendChild(addBooksToNote(obj)); div1.appendChild(createP(obj)); div1.appendChild(createBtnDelete(obj)); return div1; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function addNoteButton(note) {\n var li = $(\"<div />\", slide.contentDocument);\n li.addClass(\"noteButton\");\n var time = $(\"<div />\", slide.contentDocument);\n time.addClass(\"noteButtonTime\");\n time.text(new Date(note.time).toLocaleString());\n li.append(time);\n var sum...
[ "0.66914386", "0.6580069", "0.65291834", "0.6502622", "0.64882445", "0.63981503", "0.6386426", "0.6343098", "0.63280344", "0.6309284", "0.6307025", "0.6292318", "0.6288135", "0.6271138", "0.6243464", "0.62407684", "0.6219146", "0.61958194", "0.6192781", "0.6188629", "0.618485...
0.6631468
1
creates p element that displays the date
function createP(obj) { let p = document.createElement("p"); p.className = "date"; p.innerText = obj.date; return p; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function writeDate() {\n // write date\n var jumbo = document.querySelector('div.jumbotron');\n var myPara = document.createElement('p');\n myPara.textContent = \"Today's date: \" + month + ' - ' + date + ' - ' + year;\n jumbo.appendChild(myPara);\n\n}", "function renderDate() {\n dateDiv.text(...
[ "0.737805", "0.73727024", "0.7317367", "0.6804612", "0.67985934", "0.6750046", "0.67458224", "0.671332", "0.6702229", "0.6698476", "0.66921663", "0.66776747", "0.6669386", "0.6647061", "0.66221535", "0.6616634", "0.65552646", "0.65515614", "0.6533203", "0.6515853", "0.651577"...
0.7783231
0
Button for deleting note
function createBtnDelete(obj) { let btnDelete = document.createElement("button"); btnDelete.id = "delete-button"; btnDelete.className = "note-button"; btnDelete.addEventListener("click", function () { obj.removeNote(); }); btnDelete.appendChild(createImgDelete()); return btnDelete; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function note_delete()\n {\n // grab the .data element of note to delete\n var axe_it = $(this).data(\"_id\");\n $.ajax(\n {\n url: \"/api/notes/\" + axe_it,\n method: \"DELETE\"\n }).then(function()\n {\n // on success, hide the modal\n bootbox.hideAll();\n });\n }", "...
[ "0.7804993", "0.7800597", "0.77716035", "0.77004653", "0.76611567", "0.76363426", "0.7614372", "0.75974613", "0.75554043", "0.753928", "0.7380739", "0.73229736", "0.72809994", "0.72732", "0.72609866", "0.72429264", "0.71927845", "0.71921134", "0.71888465", "0.71425974", "0.70...
0.0
-1
The image for createBtnDelete button
function createImgDelete() { let imgDelete = document.createElement("img"); imgDelete.id = "img-delete"; imgDelete.src = "media/x.svg"; imgDelete.alt = "delete button"; imgDelete.width = "32"; imgDelete.height = "32"; imgDelete.title = "Delete"; return imgDelete; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function createDeleteButton() {\n const deleteButtonElement = document.createElement('button');\n deleteButtonElement.className = \"btn bg-transparent delete-button\";\n\n const trashImgElement = document.createElement(\"img\");\n trashImgElement.src = \"images/recycle.png\";\n\n deleteButtonElement.appendChi...
[ "0.74276906", "0.73468417", "0.7216054", "0.7010174", "0.69134593", "0.6860244", "0.68346804", "0.68064064", "0.66736424", "0.6556267", "0.6517153", "0.65078956", "0.6504571", "0.6424006", "0.6243887", "0.6184515", "0.6145393", "0.61420864", "0.6139848", "0.61227655", "0.6079...
0.69267356
4
Create div that holds the content for the note
function createDiv2(type, article) { let div2 = document.createElement("div"); div2.className = "content"; if (type == 1) { let textarea = document.createElement("div"); textarea.className = "textArea"; textarea.contentEditable = "true"; div2.appendChild(textarea); } if (type == 2) { article.className = "note note-list shadow-sm"; let inputContainer = document.createElement("div"); inputContainer.className = "input-container"; let input = document.createElement("input"); input.type = "text"; input.className = "list-input"; input.placeholder = "Add to list"; let button = document.createElement("button"); button.className = "list-btn note-button"; let imgAddList = document.createElement("img"); imgAddList.src = "media/plus.svg"; imgAddList.alt = "Add"; imgAddList.width = "28"; imgAddList.height = "28"; imgAddList.title = "Add to list"; button.appendChild(imgAddList); let node = document.createElement("ul"); node.className = "list"; inputContainer.appendChild(input); inputContainer.appendChild(button); div2.appendChild(inputContainer); div2.appendChild(node); input.addEventListener("keypress", function (event) { let e = event; if ( e.code === "Enter" && document.getElementsByClassName("list-input")[0].value != "" ) { addListItemOnClick(); } }); function addListItemOnClick() { if (input.value.length > 0) { let listItemContainer = document.createElement("div"); listItemContainer.className = "list-item-container"; let node_li = document.createElement("li"); node_li.contentEditable = "true"; node_li.className = "itemOfList"; let textnode = document.createTextNode(input.value); let span = document.createElement("SPAN"); let txt = document.createTextNode("\u00D7"); span.className = "remove-list-item"; span.addEventListener("click", () => { listItemContainer.remove(); saveNotesToLocalStorage(); }); span.appendChild(txt); node_li.appendChild(textnode); listItemContainer.appendChild(node_li); listItemContainer.appendChild(span); node.prepend(listItemContainer); div2.appendChild(node); document.getElementsByClassName("list-input")[0].value = ""; saveNotesToLocalStorage(); } } button.addEventListener("click", addListItemOnClick); } return div2; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function createNote() {\n return '<div class=\"note\"> </div> \\n';\n}", "function addNotes(){\n //i++;\n //var textfield=document.querySelector('.textfield');\n var noteslist=document.querySelector('.notesList');\n var textarea=document.querySelector('.textarea').value;\n var note=document.cre...
[ "0.8029147", "0.7413453", "0.7412704", "0.73533064", "0.72985595", "0.7111789", "0.70715487", "0.70291734", "0.69987756", "0.69801277", "0.6971854", "0.69408023", "0.6901174", "0.689776", "0.6867155", "0.68218684", "0.68079746", "0.6802814", "0.67715585", "0.6771208", "0.6734...
0.0
-1
Creates a button to confirm note changes
function createBtnConfirm() { let btnConfirm = document.createElement("button"); btnConfirm.className = "note-button note-button-bottom"; btnConfirm.addEventListener("click", function () { saveNotesToLocalStorage(); }); btnConfirm.appendChild(createImgConfirm()); return btnConfirm; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function handleNoteButtonEvent(thisObj) {\n _changed = true;\n if ($(thisObj.getHtmlIds().noteContainer).visible()) {\n if (thisObj.getStandardValue() == thisObj.getMeta().seeNoteCui) {\n thisObj.clearNote();\n }\n else {\n thisObj.hideNote();\n }\n }\n else {\n t...
[ "0.6704172", "0.6655943", "0.65650445", "0.63859004", "0.6303029", "0.62033916", "0.6119666", "0.6116401", "0.60906357", "0.6060411", "0.6059917", "0.6045325", "0.5977627", "0.5947365", "0.5937937", "0.59128815", "0.58957195", "0.5885357", "0.5877614", "0.58743775", "0.586501...
0.7303158
0
Image for createBtnConfirm function
function createImgConfirm() { let imgConfirm = document.createElement("img"); imgConfirm.src = "media/check.svg"; imgConfirm.alt = "confirm button"; imgConfirm.width = "32"; imgConfirm.height = "32"; imgConfirm.title = "Confirm"; return imgConfirm; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function createBtnConfirm() {\n let btnConfirm = document.createElement(\"button\");\n btnConfirm.className = \"note-button note-button-bottom\";\n btnConfirm.addEventListener(\"click\", function () {\n saveNotesToLocalStorage();\n });\n btnConfirm.appendChild(createImgConfirm());\n return btnConfirm;\n}"...
[ "0.7381665", "0.65416354", "0.63602394", "0.62371385", "0.6204981", "0.6187084", "0.61553764", "0.61195225", "0.609529", "0.6037567", "0.60281134", "0.60163194", "0.6009989", "0.6000285", "0.59944713", "0.59719354", "0.59646595", "0.59646595", "0.59646595", "0.59646595", "0.5...
0.71519136
1
creates dateobj from current date and binds it to the note obj
function addDate() { const noteDate = new Date(); let month = noteDate.getMonth() + 1; if (month < 10) { month = `0${month}`; } let day = noteDate.getDate(); if (day < 10) { day = `0${day}`; } return `${noteDate.getFullYear()}-${month}-${day}`; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "_setInitialDate(initialDate){\n const date = this._stringify(initialDate);\n const objectDate = new Date(date);\n return objectDate;\n }", "function prepDate(model) { return _.isEmpty(model) ? null : moment(model).toDate();}", "function initializeCurrentDate(){\n\tcurrentYear=d.getFullYear();\n\tcurr...
[ "0.63527185", "0.6269293", "0.6180642", "0.60575897", "0.60421413", "0.6031795", "0.60178787", "0.59838736", "0.59559596", "0.594456", "0.59158146", "0.58970475", "0.58958", "0.58240855", "0.5808925", "0.57719463", "0.5757563", "0.5752189", "0.5751734", "0.5748681", "0.573059...
0.53984296
95
Creates a dropdown menu for the note
function addBooksToNote(obj) { let noteDropDown = document.createElement("div"); let button = document.createElement("button"); let btnIcon = document.createElement("img"); let dropDownContent = document.createElement("div"); let dropDownList = document.createElement("ul"); noteDropDown.className = "dropdown"; noteDropDown.appendChild(button); noteDropDown.appendChild(dropDownContent); button.className = "note-button"; button.addEventListener("click", () => { clearNoteDropDown(); addBooksToDropDown(obj, dropDownContent); dropDownContent.style.display = "block"; }); button.appendChild(btnIcon); btnIcon.src = "media/journal-plus.svg"; btnIcon.width = "24"; btnIcon.height = "24"; btnIcon.title = "Move to notebook"; dropDownContent.className = "dropdown-content shadow-sm"; dropDownContent.appendChild(dropDownList); return noteDropDown; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function generateDropdownMenu() {\n\tvar dropdownContent = document.getElementById(\"dropdown-content\");\n\tvar oldDropdownList = document.getElementById(\"dropdownList\");\n\tif (dropdownContent) {\n\t\tvar newDropdownList = document.createElement(\"ul\");\n\t\tnewDropdownList.id = \"dropdownList\";\n\t\tfor (va...
[ "0.66719514", "0.66393393", "0.662687", "0.65324175", "0.6475894", "0.6362708", "0.6341031", "0.6317304", "0.63116854", "0.626956", "0.62344635", "0.62289363", "0.62193483", "0.62162197", "0.6201725", "0.61597914", "0.6149038", "0.6147206", "0.6103805", "0.6051121", "0.604445...
0.6532493
3
Adds a list of note books to dropdown of addBooksToNote and a checkbox to move multiple notes.
function addBooksToDropDown(obj, dropDownContent) { let closeButton = document.createElement("button"); let closeButtonIcon = document.createElement("img"); dropDownContent.appendChild(closeButton); closeButton.className = "note-button close-btn-dropdown"; closeButton.addEventListener("click", () => { dropDownContent.style.display = "none"; }); closeButton.appendChild(closeButtonIcon); closeButtonIcon.src = "media/x.svg"; closeButtonIcon.height = "18"; closeButtonIcon.width = "18"; closeButtonIcon.alt = "Close dropdown"; closeButtonIcon.title = "close"; closeButtonIcon.className = "close-btn-dropdown-img"; for (let i = 0; i < existingNoteBooks.length; i++) { let li = document.createElement("li"); li.className = "dropdown-li"; let option = document.createElement("a"); option.href = "#"; option.className = "dropdown-option dropdown-a"; option.textContent = existingNoteBooks[i].getTitle(); option.addEventListener("click", (element) => { if (obj.checked == true || obj.checkBox.style.display == "none") { obj.setTitleOfNoteBook(element.target.innerText); saveNotesToLocalStorage(); globalUpdate(); } allNotes.forEach((element) => { if (element.checkBox.checked == true) { element.titleOfNoteBook = existingNoteBooks[i].getTitle(); element.checkBox.checked = false; saveNotesToLocalStorage(); globalUpdate(); } }); dropDownContent.style.display = "none"; }); li.appendChild(option); dropDownContent.appendChild(li); } let selectToMove = document.createElement("button"); selectToMove.textContent = "SELECT MORE"; selectToMove.className = "btn btn-outline-secondary btn-sm btn-block dropdown-btn"; selectToMove.addEventListener("click", () => { moveSelected(true); }); dropDownContent.appendChild(selectToMove); closeOnClickOutside(obj, dropDownContent); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function addBooksToNote(obj) {\n let noteDropDown = document.createElement(\"div\");\n let button = document.createElement(\"button\");\n let btnIcon = document.createElement(\"img\");\n let dropDownContent = document.createElement(\"div\");\n let dropDownList = document.createElement(\"ul\");\n\n noteDropDo...
[ "0.63081235", "0.61158514", "0.58664095", "0.58441114", "0.58294445", "0.57431066", "0.5701966", "0.5695114", "0.56449246", "0.56367624", "0.56282496", "0.55916095", "0.5513622", "0.54907507", "0.5467154", "0.5459311", "0.5435347", "0.54313064", "0.54181194", "0.539785", "0.5...
0.6546685
0