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
Methode pour le responsive du carousel
onWindowResize () { let mobile = window.innerWidth < 1200 // Déclare la variable mobile qui cible la fenetre avec une largeur inferieure à 1200px if (mobile !== this.isMobile) { // Si la valeur de mobile est differente de celle de this.isMobile this.isMobile = mobile // Change la valeur de la propriété d'instance this.setStyle() // Aplique le style this.moveCallbacks.forEach(cb => cb(this.currentItem)) // Rappel des callBacks avec l'item courant } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function instragramSlider(){\n if ( $('.instragram-slider').length){\n $('.instragram-slider').owlCarousel({\n loop:true,\n margin:30,\n dotsSpeed: 2000,\n navSpeed: 2000,\n animateOut: 'slideOutDown',\n ani...
[ "0.70339227", "0.7016264", "0.7009934", "0.6973607", "0.68727356", "0.67571515", "0.67532676", "0.6725487", "0.67017037", "0.668977", "0.6689748", "0.6679989", "0.6663747", "0.66531956", "0.66531956", "0.66531956", "0.6624463", "0.66191256", "0.66084635", "0.6597657", "0.6587...
0.0
-1
Calculate the maximum number of pages
function numPages() { return Math.ceil(maxentries / opts.items_per_page); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function numPages() {\n\t\t\treturn Math.ceil(maxentries/opts.items_per_page);\n\t\t}", "function numPages() {\n\t\t\treturn Math.ceil(maxentries/opts.items_per_page);\n\t\t}", "function numPages() {\n\t\t\treturn Math.ceil(maxentries/opts.items_per_page);\n\t\t}", "function numPages() {\n\t\t\treturn Math.c...
[ "0.79655004", "0.79655004", "0.79655004", "0.79655004", "0.79655004", "0.75471026", "0.7452384", "0.7296691", "0.71718264", "0.7142934", "0.7096851", "0.7054718", "0.6996129", "0.69892967", "0.69457865", "0.69439846", "0.6927006", "0.6913025", "0.69084144", "0.68147165", "0.6...
0.7915858
5
This function inserts the pagination links into the container element
function drawLinks() { panel.empty(); var interval = getInterval(); var np = numPages(); // This helper function returns a handler function that calls pageSelected with the right page_id var getClickHandler = function(page_id) { return function(evt) { return pageSelected(page_id, evt); } } // Helper function for generating a single link (or a span tag if it'S the current page) var appendItem = function(page_id, appendopts) { page_id = page_id < 0 ? 0 : (page_id < np ? page_id : np - 1); // Normalize page id to sane value appendopts = jQuery.extend({ text: page_id + 1, classes: "" }, appendopts || {}); if (page_id == current_page) { var lnk = $("<span class='this_p'>" + (appendopts.text) + "</span>"); } else { var lnk = $("<a>" + (appendopts.text) + "</a>") .bind("click", getClickHandler(page_id)) .attr('href', opts.link_to.replace(/__id__/, page_id)); } if (appendopts.classes) { lnk.removeAttr('class'); lnk.addClass(appendopts.classes); } panel.append(lnk); } // Generate "Previous"-Link if (opts.prev_text && (current_page > 0 || opts.prev_show_always)) { appendItem(current_page - 1, { text: opts.prev_text, classes: "disabled" }); } // Generate starting points if (interval[0] > 0 && opts.num_edge_entries > 0) { var end = Math.min(opts.num_edge_entries, interval[0]); for (var i = 0; i < end; i++) { appendItem(i); } if (opts.num_edge_entries < interval[0] && opts.ellipse_text) { jQuery("<span class='ellipse'>" + opts.ellipse_text + "</span>").appendTo(panel); } } // Generate interval links for (var i = interval[0]; i < interval[1]; i++) { appendItem(i); } // Generate ending points if (interval[1] < np && opts.num_edge_entries > 0) { if (np - opts.num_edge_entries > interval[1] && opts.ellipse_text) { jQuery("<span class='ellipse'>" + opts.ellipse_text + "</span>").appendTo(panel); } var begin = Math.max(np - opts.num_edge_entries, interval[1]); for (var i = begin; i < np; i++) { appendItem(i); } } // Generate "Next"-Link if (opts.next_text && (current_page < np - 1 || opts.next_show_always)) { appendItem(current_page + 1, { text: opts.next_text, classes: "disabled" }); } //新增跳页20130613 if(opts.jump){ jQuery("<span class='pagjump_box'>跳到<input class='"+opts.jump_input_style+"' type='text' /><button type='button' class='"+opts.jump_button_style+"'>确定</button>").appendTo(panel).delegate("button","click",function(e){ var page_id = jQuery(this).prev(".pagjump_txt").val(); if(page_id == ""){ return false; }else if(page_id > np || page_id < 0){ alert("超出页码范围!"); return false; }; pageSelected(page_id-1,e); }); }; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function appendPageLinks(list) {\n // Remove old pagination if present, create paginstion DOM containters, loop over number of pages, create links, add active inital active class, addEvent listener with pageLinkAction helper function\n removeElement('.pagination');\n const page_div = createElement(\"DIV\", {...
[ "0.7636922", "0.75864637", "0.75830483", "0.7524139", "0.74755853", "0.74550754", "0.7446967", "0.7445275", "0.7370263", "0.72896075", "0.7258213", "0.7247914", "0.7246593", "0.72193336", "0.7198972", "0.7150856", "0.7132298", "0.7077832", "0.7075861", "0.70649266", "0.697356...
0.0
-1
Affichage HTML de la page index
addOnIndexPage() { let container = document.getElementById("products-list") const toInsert = `<li class="bg-first card-teddies"> <a href="front-end/product.html?id=${this.id}"> <figure class="card-product"> <img src="${this.imageUrl}" alt="${this.name}" class="picture-bear"> <figcaption> <h2>${this.name}</h2> <p>${this.description}</p> <span class="price">${(Math.round(this.price) / 100).toFixed(2).replace(".",",")} €</span> </figcaption> </figure> </a> </li>` container.innerHTML += toInsert }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function goIndex() {\n fs.readFile(configs.html_files.index, (err, f) => {\n if(err) return res.end('OUPS... A probleme come here...')\n\n res.end(f)\n })\n }", "function display_index(req, res){\n res.writeHead(200, {'Content-Type': 'text/html'});\n\n fs.readFile('./html/index.htm...
[ "0.6924862", "0.6829744", "0.664806", "0.6628941", "0.6476999", "0.6437261", "0.6429056", "0.64268917", "0.63510096", "0.6258528", "0.6208903", "0.6199088", "0.6123302", "0.61192924", "0.6096376", "0.6059331", "0.6040412", "0.60179216", "0.60105205", "0.60042936", "0.59976524...
0.0
-1
Affichage HTML d'un produit
addOnproductPage() { let contain = document.getElementById("contain-product") const insertHTML = `<div class="card-product card-responsive"> <div class="picture-box"> <img src="${this.imageUrl}" alt="${this.name}" class="picture-teddy"> </div> <div class="product-info"> <div class="product-name"> <h2>${this.name}</h2> <div> <i class="fas fa-paw"></i> <i class="fas fa-paw"></i> <i class="fas fa-paw"></i> <i class="fas fa-paw"></i> <i class="fas fa-paw"></i> </div> </div> <p>${this.description}</p> <div class="contain-color" class="all-colors"> <select name="colors" id="colors" required> </select> </div> <span>Quantité : <input type="number" id="quantity" name="quantity" min="1"> </span> <span class="price">${(Math.round(this.price) / 100).toFixed(2).replace(".",",")} €</span> <button class="add-btn" id="confirm-box"> <span>Ajouter au panier</span> </button> </div> </div> ` contain.innerHTML += insertHTML let choice = contain.querySelector("#colors"); this.colors.forEach (function (colors) { let option = document.createElement("option"); option.value = colors; option.textContent = colors; choice.appendChild(option); }) let customerChoise = document.querySelector(".add-btn"); customerChoise.addEventListener('click', () => { //Récupération choix couleur et stockage dans variable global this this.colorChoice = document.querySelector("#colors"); this.colorChoice = this.colorChoice.options[this.colorChoice.selectedIndex].value; //Récupération quantité et stockage dans variable global this this.quantityChoice = parseInt(document.getElementById("quantity").value); //Appel de la fonction d'ajout au panier si la quantité est suffisante if (this.quantityChoice >= 1) { addToBasket(this); setTimeout("messageTeddy()", 400); //Sinon renvoi un message d'erreur } else { messageTeddyError() } }) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function _getRulaiHtml(content){\n\n}", "render(){return html``}", "static get html() {\n return '';\n }", "renderHTML() {\n \n }", "function carritoHTML() {\n\t//limpiar el html\n\tlimpiarHTML();\n\n\t//recorre el carrito y genera el html\n\tarticulosCarrito.forEach((curso) => {\n\t\tconst ro...
[ "0.70378494", "0.6624007", "0.6477401", "0.64571035", "0.6385427", "0.62243855", "0.61632437", "0.61604613", "0.61549145", "0.61514324", "0.6122437", "0.6120842", "0.6119651", "0.6101949", "0.60597396", "0.60502464", "0.60432124", "0.6025386", "0.6001747", "0.5967929", "0.596...
0.0
-1
use this function to change screens
function PushScreen (scr) { if (scr == "game") { game_Init(); } screen = scr; console.log ("Started screen " + scr); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function changeScreen(screen) {\n activeScreen = screen;\n}", "function changeScreen(){\n if (state === `menu`){\n state = `main`;\n }\n else if (state === `end`){\n state = `menu`;\n count = 0;\n }\n }", "function menuScreen() {\n if (currentPage === 'highscorepage') {\n $box2.ani...
[ "0.8108876", "0.7516841", "0.70739293", "0.70670134", "0.7039308", "0.6971808", "0.6903651", "0.6872017", "0.6808865", "0.67925936", "0.6768764", "0.6754405", "0.66968", "0.6684361", "0.6663337", "0.6634558", "0.6624804", "0.65762776", "0.6563543", "0.6545191", "0.65284866", ...
0.6364558
23
surname can be have no value or reg exp
function validateSurname(surname){ const validSurname = /[A-Za-zА-Яа-яЁёІіЇїЄє']/; const userSurname = surname.value || "no info"; const validationResult = validateData(validSurname, userSurname, surname); return validationResult; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function regExpLastName() {\n // Récupération des données saisies\n const lastNameValid = contact.lastName;\n // Injection du HTML\n const checklastName = document.querySelector(\"#lastNameErrorMsg\");\n\n // Indication de la bonne saisie ou l'erreur dans le HTML\n if (/^([A-Za-z]{3,20})?([-]{0,1...
[ "0.6811819", "0.6428622", "0.6312391", "0.62947375", "0.628149", "0.6278202", "0.6204949", "0.61900586", "0.615965", "0.60962886", "0.60597867", "0.6051963", "0.6034478", "0.6034478", "0.6025808", "0.6011059", "0.5980031", "0.5978023", "0.5961357", "0.5955188", "0.59283406", ...
0.7801563
0
const Promise = require('./promise');
function resolve (dir) { return path.join(__dirname, dir) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function Promise() {\n}", "function loadImplementation(){\n if(typeof window.Promise === 'undefined'){\n throw new Error(\"any-promise browser requires a polyfill or explicit registration\"+\n \" e.g: require('any-promise/register/bluebird')\")\n }\n return {\n Promise: window.Promise,\n impleme...
[ "0.74298716", "0.68135184", "0.68135184", "0.68135184", "0.68135184", "0.68135184", "0.68135184", "0.68135184", "0.68135184", "0.68135184", "0.68135184", "0.68135184", "0.68135184", "0.66387427", "0.66290265", "0.6529742", "0.64478767", "0.64257103", "0.6381846", "0.6334201", ...
0.0
-1
Inside algorithm c.f. Durbin, Eddy, Krogh & Mitchison (1998) "Biological Sequence Analysis" or other sources e.g.
function ruleWeight (inside, text, maxSubseqLen, i, j, k, opt) { var rhsLen = opt.rhs.length if ((rhsLen === 0 && i !== j) || (rhsLen === 1 && k < j)) return 0 var w = opt.weight for (var pos = 0; w && pos < rhsLen; ++pos) { var node = opt.rhs[pos] var start = pos ? k : i, len = pos ? (j-k) : (k-i), idx = len if (start && len > maxSubseqLen) { if (start + len === text.length) idx = maxSubseqLen + 1 else return 0 } var insideCell w *= (node.type === 'term' ? (node.text.length === len && node.text === text.substr(start,len) ? 1 : 0) : (((insideCell = inside[start][idx]) && insideCell[node.rank]) || 0)) } return w }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function findTransformSequence(array) {\n // Insert your solution code here\n}", "function seq(){\nalert(\"A sequence is a set of numbers arranged in a particular order eg 2,4,6,8,10,.....In this sequence to get the next number add 2 to the previous number. If these numbers are given in no particular order eg...
[ "0.60628504", "0.60232025", "0.5873245", "0.5867661", "0.57680315", "0.5568463", "0.5527021", "0.552459", "0.53636116", "0.53552717", "0.53358203", "0.53270155", "0.5309759", "0.52928036", "0.528984", "0.52870315", "0.5273002", "0.5267845", "0.5266032", "0.5258902", "0.524738...
0.0
-1
Easy API for creating new setFilters
function setFilters() {}
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function setFilters(){}", "function setFilters(){}", "function setFilters(){}", "function setFilters(){}", "function setFilters(){}", "function setFilters(){}", "function setFilters(){}", "function setFilters(){}", "function setFilters(){}" ]
[ "0.8424095", "0.8424095", "0.8424095", "0.8424095", "0.8424095", "0.8424095", "0.8424095", "0.8424095", "0.8424095" ]
0.0
-1
Implement the identical functionality for filter and not
function winnow( elements, qualifier, not ) { if ( jQuery.isFunction( qualifier ) ) { return jQuery.grep( elements, function( elem, i ) { /* jshint -W018 */ return !!qualifier.call( elem, i, elem ) !== not; }); } if ( qualifier.nodeType ) { return jQuery.grep( elements, function( elem ) { return ( elem === qualifier ) !== not; }); } if ( typeof qualifier === "string" ) { if ( risSimple.test( qualifier ) ) { return jQuery.filter( qualifier, elements, not ); } qualifier = jQuery.filter( qualifier, elements ); } return jQuery.grep( elements, function( elem ) { return ( jQuery.inArray( elem, qualifier ) >= 0 ) !== not; }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "filter() {\n\t}", "filter() {\n\t}", "function filter() {\n \n}", "function filterFunction() {\n \n}", "function Nothing$prototype$filter(pred) {\n return this;\n }", "removeAllFilters() {}", "function noFilter(filterObj) {\n return Object.\n keys(filterObj).\n ...
[ "0.7415891", "0.7415891", "0.71924883", "0.68619496", "0.67648804", "0.6652573", "0.64584637", "0.64584637", "0.64584637", "0.64584637", "0.6294628", "0.62928224", "0.6256001", "0.62469697", "0.6207571", "0.61991894", "0.61926854", "0.6190803", "0.6184332", "0.61646616", "0.6...
0.0
-1
Convert Stringformatted options into Objectformatted ones and store in cache
function createOptions( options ) { var object = optionsCache[ options ] = {}; jQuery.each( options.match( rnotwhite ) || [], function( _, flag ) { object[ flag ] = true; }); return object; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function createOptions( options ) {\n var object = optionsCache[ options ] = {};\n jQuery.each( options.split( core_rspace ), function( _, flag ) {\n object[ flag ] = true;\n });\n return object;\n }", "function createOptions( options ) {\n\t var object = optionsCache...
[ "0.65983355", "0.6588602", "0.65088433", "0.64988786", "0.6476238", "0.6476238", "0.6476238", "0.6476238", "0.6476238", "0.6476238", "0.6476238", "0.6476238", "0.6476238", "0.6476238", "0.6476238", "0.6476238", "0.647308", "0.6450778", "0.64444906", "0.6403399", "0.6280776", ...
0.0
-1
Cleanup method for dom ready events
function detach() { if ( document.addEventListener ) { document.removeEventListener( "DOMContentLoaded", completed, false ); window.removeEventListener( "load", completed, false ); } else { document.detachEvent( "onreadystatechange", completed ); window.detachEvent( "onload", completed ); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function completed(){document.removeEventListener(\"DOMContentLoaded\",completed);window.removeEventListener(\"load\",completed);jQuery.ready();}// Catch cases where $(document).ready() is called", "function completed(){document.removeEventListener(\"DOMContentLoaded\",completed);window.removeEventListener(\"loa...
[ "0.76165706", "0.76165706", "0.76165706", "0.76165706", "0.7559291", "0.7559291", "0.7508524", "0.7364877", "0.73230135", "0.73230135", "0.73230135", "0.73230135", "0.73230135", "0.73230135", "0.73230135", "0.73230135", "0.7263893", "0.7263893", "0.7263893", "0.7263893", "0.7...
0.0
-1
The ready event handler and self cleanup method
function completed() { // readyState === "complete" is good enough for us to call the dom ready in oldIE if ( document.addEventListener || event.type === "load" || document.readyState === "complete" ) { detach(); jQuery.ready(); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function readyCallBack() {\n}", "static ready() { }", "onReady() {}", "ready() {\r\n\t\tsuper.ready();\r\n\t}", "ready() {\n super.ready();\n }", "ready() {\n super.ready();\n }", "ready() {\n super.ready();\n }", "ready() {\n super.ready();\n }", "ready() {\...
[ "0.72463065", "0.7211212", "0.7172562", "0.7149137", "0.70596856", "0.70596856", "0.70596856", "0.70596856", "0.70596856", "0.70596856", "0.70596856", "0.70596856", "0.70596856", "0.70596856", "0.70596856", "0.70596856", "0.7042607", "0.7042607", "0.7042607", "0.7042607", "0....
0.0
-1
checks a cache object for emptiness
function isEmptyDataObject( obj ) { var name; for ( name in obj ) { // if the public data object is empty, the private is still empty if ( name === "data" && jQuery.isEmptyObject( obj[name] ) ) { continue; } if ( name !== "toJSON" ) { return false; } } return true; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "emptyCache() {\n this.cache = {};\n }", "emptyCache() {\n this.cache = {};\n }", "function clearcache() {\n dbgmsg( 'retrieveData: Internal cache contain attribute values for: ' + Object.keys( cache ).sort().join( '; ' ) );\n cache = {};\n logmsg( 'retrieveData: cache cleared.' );\n }", "fu...
[ "0.70517987", "0.70517987", "0.6629567", "0.6556332", "0.6533182", "0.64966077", "0.64923435", "0.64923435", "0.64923435", "0.6364117", "0.6348747", "0.62630934", "0.6232238", "0.61704683", "0.61589825", "0.61395884", "0.6134505", "0.6134505", "0.61306685", "0.61306685", "0.6...
0.0
-1
Used in buildFragment, fixes the defaultChecked property
function fixDefaultChecked( elem ) { if ( rcheckableType.test( elem.type ) ) { elem.defaultChecked = elem.checked; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function fixDefaultChecked( elem ) {\n if ( manipulation_rcheckableType.test( elem.type ) ) {\n elem.defaultChecked = elem.checked;\n }\n }", "function fixDefaultChecked( elem ) {\n if ( rcheckableType.test( elem.type ) ) {\n elem.defaultChecked = elem.checked;\n }\n }", ...
[ "0.824838", "0.81953275", "0.81953275", "0.81482494", "0.8129133", "0.8113696", "0.8113696", "0.8113696", "0.8110808", "0.8091867", "0.8091867", "0.80656034", "0.80656034", "0.80656034", "0.80656034", "0.80656034", "0.80656034", "0.80656034", "0.80656034", "0.80656034", "0.80...
0.7996019
93
Support: IE<8 Manipulating tables requires a tbody
function manipulationTarget( elem, content ) { return jQuery.nodeName( elem, "table" ) && jQuery.nodeName( content.nodeType !== 11 ? content : content.firstChild, "tr" ) ? elem.getElementsByTagName("tbody")[0] || elem.appendChild( elem.ownerDocument.createElement("tbody") ) : elem; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function r(a,b){return fa.nodeName(a,\"table\")&&fa.nodeName(11!==b.nodeType?b:b.firstChild,\"tr\")?a.getElementsByTagName(\"tbody\")[0]||a.appendChild(a.ownerDocument.createElement(\"tbody\")):a}", "function m(a,b){return _.nodeName(a,\"table\")&&_.nodeName(11!==b.nodeType?b:b.firstChild,\"tr\")?a.getElementsBy...
[ "0.7501409", "0.74235845", "0.71012956", "0.7088856", "0.6881842", "0.681869", "0.6817269", "0.6817269", "0.6807573", "0.67780167", "0.67652106", "0.6745558", "0.6745558", "0.6683416", "0.6683416", "0.66757476", "0.6658776", "0.66572535", "0.66502017", "0.66502017", "0.664657...
0.0
-1
Replace/restore the type attribute of script elements for safe DOM manipulation
function disableScript( elem ) { elem.type = (jQuery.find.attr( elem, "type" ) !== null) + "/" + elem.type; return elem; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function disableScript( elem ) {\r\n\tvar attr = elem.getAttributeNode(\"type\");\r\n\telem.type = ( attr && attr.specified ) + \"/\" + elem.type;\r\n\treturn elem;\r\n}", "function disableScript( elem ) {\n\tvar attr = elem.getAttributeNode(\"type\");\n\telem.type = ( attr && attr.specified ) + \"/\" + elem.typ...
[ "0.7015204", "0.6983948", "0.6983948", "0.6983948", "0.6983948", "0.6983948", "0.6983948", "0.6983948", "0.6983948", "0.6983948", "0.6983948", "0.6941072", "0.69362515", "0.69002753", "0.68869877", "0.68869877", "0.68869877", "0.6885398", "0.6884041", "0.68813604", "0.6873264...
0.0
-1
Mark scripts as having already been evaluated
function setGlobalEval( elems, refElements ) { var elem, i = 0; for ( ; (elem = elems[i]) != null; i++ ) { jQuery._data( elem, "globalEval", !refElements || jQuery._data( refElements[i], "globalEval" ) ); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "globalEval() {\n // phase one, if we have head inserts, we build up those before going into the script eval phase\n let insertHeadElems = new ExtDomQuery_1.ExtDomQuery(...this.internalContext.getIf(Const_1.DEFERRED_HEAD_INSERTS).value);\n insertHeadElems.runHeadInserts(true);\n // phas...
[ "0.5987435", "0.5798831", "0.5772783", "0.57142234", "0.5673525", "0.56659687", "0.5592892", "0.5492997", "0.5467838", "0.53731847", "0.5336245", "0.5309647", "0.5303123", "0.52803385", "0.52720535", "0.52717704", "0.52695596", "0.52677536", "0.52672625", "0.52672625", "0.525...
0.5192963
99
return a css property mapped to a potentially vendor prefixed property
function vendorPropName( style, name ) { // shortcut for names that are not vendor prefixed if ( name in style ) { return name; } // check for vendor prefixed names var capName = name.charAt(0).toUpperCase() + name.slice(1), origName = name, i = cssPrefixes.length; while ( i-- ) { name = cssPrefixes[ i ] + capName; if ( name in style ) { return name; } } return origName; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function vendorPropName(name){// Shortcut for names that are not vendor prefixed\nif(name in emptyStyle){return name;}// Check for vendor prefixed names\nvar capName=name[0].toUpperCase()+name.slice(1),i=cssPrefixes.length;while(i--){name=cssPrefixes[i]+capName;if(name in emptyStyle){return name;}}}// Return a pro...
[ "0.81199294", "0.81199294", "0.78175336", "0.78175336", "0.78175336", "0.78175336", "0.78175336", "0.78175336", "0.78175336", "0.78175336", "0.7741535", "0.77281314", "0.76649904", "0.76344436", "0.76290935", "0.7543812", "0.7490448", "0.74820906", "0.7476511", "0.74624354", ...
0.0
-1
Animations created synchronously will run synchronously
function createFxNow() { setTimeout(function() { fxNow = undefined; }); return ( fxNow = jQuery.now() ); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "_playAnimation() {\n if (this._animationLast === undefined && this._animationQueue.length > 0) {\n this._animationLast = this._animationCurrent;\n this._animationCurrent = this._animationQueue.shift();\n console.log(\"New: \" + this._animationCurrent.name);\n this...
[ "0.72297084", "0.7172655", "0.6751781", "0.6701827", "0.66490537", "0.6644208", "0.66413045", "0.65767395", "0.6515558", "0.64943016", "0.64906734", "0.6407048", "0.6392758", "0.6383256", "0.63779354", "0.6373179", "0.63684577", "0.6353303", "0.63494754", "0.6331653", "0.6321...
0.0
-1
Generate parameters to create a standard animation
function genFx( type, includeWidth ) { var which, attrs = { height: type }, i = 0; // if we include width, step value is 1 to do all cssExpand values, // if we don't include width, step value is 2 to skip over Left and Right includeWidth = includeWidth ? 1 : 0; for ( ; i < 4 ; i += 2 - includeWidth ) { which = cssExpand[ i ]; attrs[ "margin" + which ] = attrs[ "padding" + which ] = type; } if ( includeWidth ) { attrs.opacity = attrs.width = type; } return attrs; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function setParameters() {\n params.viscosity = 0.02;\n params.u0 = -amplitude;\n params.one36th = 1 / 36;\n params.one9th = 1 / 9;\n params.four9ths = 4 / 9;\n params.gridSize = 5;\n params.m = int(height / params.gridSize);\n params.n = int(width / params.gridSize);\n}", "function generateAnimationPara...
[ "0.6477499", "0.6449747", "0.6239411", "0.62102515", "0.62051743", "0.6019592", "0.599829", "0.594838", "0.5940393", "0.5940393", "0.5912163", "0.5873654", "0.5832134", "0.5828958", "0.58236474", "0.5820797", "0.5813001", "0.579854", "0.57910967", "0.57835335", "0.5780475", ...
0.0
-1
Base "constructor" for jQuery.ajaxPrefilter and jQuery.ajaxTransport
function addToPrefiltersOrTransports( structure ) { // dataTypeExpression is optional and defaults to "*" return function( dataTypeExpression, func ) { if ( typeof dataTypeExpression !== "string" ) { func = dataTypeExpression; dataTypeExpression = "*"; } var dataType, i = 0, dataTypes = dataTypeExpression.toLowerCase().match( rnotwhite ) || []; if ( jQuery.isFunction( func ) ) { // For each dataType in the dataTypeExpression while ( (dataType = dataTypes[i++]) ) { // Prepend if requested if ( dataType.charAt( 0 ) === "+" ) { dataType = dataType.slice( 1 ) || "*"; (structure[ dataType ] = structure[ dataType ] || []).unshift( func ); // Otherwise append } else { (structure[ dataType ] = structure[ dataType ] || []).push( func ); } } } }; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "constructor() {\n this.config = Config.ajax;\n this.xhr;\n this.Serialize;\n }", "function AjaxPipelineConstructor() {\r\n BaseObject.call(this,arguments);\r\n }", "function Ajax(__constructor) {\r\n if (Params.env.isFirefox) return GM_xmlhttpRequest(__constructor);\r\n ...
[ "0.6993283", "0.6822893", "0.6371214", "0.6163058", "0.59267855", "0.58393145", "0.5837328", "0.5837328", "0.5829274", "0.5829274", "0.5829274", "0.5829274", "0.5829274", "0.5829274", "0.5797885", "0.5787472", "0.5787472", "0.5744089", "0.573186", "0.5730097", "0.5662906", ...
0.0
-1
Base inspection function for prefilters and transports
function inspectPrefiltersOrTransports( structure, options, originalOptions, jqXHR ) { var inspected = {}, seekingTransport = ( structure === transports ); function inspect( dataType ) { var selected; inspected[ dataType ] = true; jQuery.each( structure[ dataType ] || [], function( _, prefilterOrFactory ) { var dataTypeOrTransport = prefilterOrFactory( options, originalOptions, jqXHR ); if ( typeof dataTypeOrTransport === "string" && !seekingTransport && !inspected[ dataTypeOrTransport ] ) { options.dataTypes.unshift( dataTypeOrTransport ); inspect( dataTypeOrTransport ); return false; } else if ( seekingTransport ) { return !( selected = dataTypeOrTransport ); } }); return selected; } return inspect( options.dataTypes[ 0 ] ) || !inspected[ "*" ] && inspect( "*" ); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function inspectPrefiltersOrTransports(structure, options, originalOptions, jqXHR) {\n\n var inspected = {},\n seekin...
[ "0.6271232", "0.62278324", "0.6089844", "0.6089844", "0.6089844", "0.6089844", "0.6089844", "0.6089844", "0.6089844", "0.6089844", "0.6089844", "0.6089844", "0.607385", "0.60586876", "0.60586876", "0.6036968", "0.601241", "0.601241", "0.601241", "0.601241", "0.601241", "0.6...
0.0
-1
A special extend for ajax options that takes "flat" options (not to be deep extended) Fixes 9887
function ajaxExtend( target, src ) { var deep, key, flatOptions = jQuery.ajaxSettings.flatOptions || {}; for ( key in src ) { if ( src[ key ] !== undefined ) { ( flatOptions[ key ] ? target : ( deep || (deep = {}) ) )[ key ] = src[ key ]; } } if ( deep ) { jQuery.extend( true, target, deep ); } return target; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function ajaxExtend(target,src){var key,deep,flatOptions=jQuery.ajaxSettings.flatOptions||{};for(key in src){if(src[key]!==undefined){(flatOptions[key]?target:deep||(deep={}))[key]=src[key];}}if(deep){jQuery.extend(true,target,deep);}}", "function ajaxExtend(target,src){var key,deep,flatOptions=jQuery.ajaxSettin...
[ "0.7667176", "0.7610428", "0.75662833", "0.75662833", "0.75662833", "0.75662833", "0.75662833", "0.75662833", "0.7547157", "0.7547157", "0.7527075", "0.74550503", "0.73181564", "0.7311414", "0.72918135", "0.7290993", "0.7256022", "0.724169", "0.7240736", "0.7240736", "0.72259...
0.0
-1
Handles responses to an ajax request: finds the right dataType (mediates between contenttype and expected dataType) returns the corresponding response
function ajaxHandleResponses( s, jqXHR, responses ) { var firstDataType, ct, finalDataType, type, contents = s.contents, dataTypes = s.dataTypes; // Remove auto dataType and get content-type in the process while ( dataTypes[ 0 ] === "*" ) { dataTypes.shift(); if ( ct === undefined ) { ct = s.mimeType || jqXHR.getResponseHeader("Content-Type"); } } // Check if we're dealing with a known content-type if ( ct ) { for ( type in contents ) { if ( contents[ type ] && contents[ type ].test( ct ) ) { dataTypes.unshift( type ); break; } } } // Check to see if we have a response for the expected dataType if ( dataTypes[ 0 ] in responses ) { finalDataType = dataTypes[ 0 ]; } else { // Try convertible dataTypes for ( type in responses ) { if ( !dataTypes[ 0 ] || s.converters[ type + " " + dataTypes[0] ] ) { finalDataType = type; break; } if ( !firstDataType ) { firstDataType = type; } } // Or just use first one finalDataType = finalDataType || firstDataType; } // If we found a dataType // We add the dataType to the list if needed // and return the corresponding response if ( finalDataType ) { if ( finalDataType !== dataTypes[ 0 ] ) { dataTypes.unshift( finalDataType ); } return responses[ finalDataType ]; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function ajaxHandleResponses(s,jqXHR,responses){var firstDataType,ct,finalDataType,type,contents=s.contents,dataTypes=s.dataTypes;// Remove auto dataType and get content-type in the process\nwhile(dataTypes[0]===\"*\"){dataTypes.shift();if(ct===undefined){ct=s.mimeType||jqXHR.getResponseHeader(\"Content-Type\");}}...
[ "0.78495306", "0.7837287", "0.7837287", "0.7776159", "0.77616936", "0.7757058", "0.7718631", "0.77153635", "0.7672706", "0.7629886", "0.7614238", "0.7604389", "0.7600136", "0.75993776", "0.75971514", "0.75971514", "0.75971514", "0.75971514", "0.75971514", "0.75971514", "0.759...
0.0
-1
Chain conversions given the request and the original response Also sets the responseXXX fields on the jqXHR instance
function ajaxConvert( s, response, jqXHR, isSuccess ) { var conv2, current, conv, tmp, prev, converters = {}, // Work with a copy of dataTypes in case we need to modify it for conversion dataTypes = s.dataTypes.slice(); // Create converters map with lowercased keys if ( dataTypes[ 1 ] ) { for ( conv in s.converters ) { converters[ conv.toLowerCase() ] = s.converters[ conv ]; } } current = dataTypes.shift(); // Convert to each sequential dataType while ( current ) { if ( s.responseFields[ current ] ) { jqXHR[ s.responseFields[ current ] ] = response; } // Apply the dataFilter if provided if ( !prev && isSuccess && s.dataFilter ) { response = s.dataFilter( response, s.dataType ); } prev = current; current = dataTypes.shift(); if ( current ) { // There's only work to do if current dataType is non-auto if ( current === "*" ) { current = prev; // Convert response if prev dataType is non-auto and differs from current } else if ( prev !== "*" && prev !== current ) { // Seek a direct converter conv = converters[ prev + " " + current ] || converters[ "* " + current ]; // If none found, seek a pair if ( !conv ) { for ( conv2 in converters ) { // If conv2 outputs current tmp = conv2.split( " " ); if ( tmp[ 1 ] === current ) { // If prev can be converted to accepted input conv = converters[ prev + " " + tmp[ 0 ] ] || converters[ "* " + tmp[ 0 ] ]; if ( conv ) { // Condense equivalence converters if ( conv === true ) { conv = converters[ conv2 ]; // Otherwise, insert the intermediate dataType } else if ( converters[ conv2 ] !== true ) { current = tmp[ 0 ]; dataTypes.unshift( tmp[ 1 ] ); } break; } } } } // Apply converter (if not an equivalence) if ( conv !== true ) { // Unless errors are allowed to bubble, catch and return them if ( conv && s[ "throws" ] ) { response = conv( response ); } else { try { response = conv( response ); } catch ( e ) { return { state: "parsererror", error: conv ? e : "No conversion from " + prev + " to " + current }; } } } } } } return { state: "success", data: response }; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function ajaxConvert(s,response,jqXHR,isSuccess){var conv2,current,conv,tmp,prev,converters={}, // Work with a copy of dataTypes in case we need to modify it for conversion\ndataTypes=s.dataTypes.slice(); // Create converters map with lowercased keys\nif(dataTypes[1]){for(conv in s.converters){converters[conv.toLo...
[ "0.6270071", "0.62634283", "0.62037927", "0.619402", "0.61934763", "0.6177949", "0.6177949", "0.617526", "0.61519706", "0.6095005", "0.6089821", "0.6086537", "0.6086537", "0.6086537", "0.6086537", "0.6086537", "0.60743695", "0.60743695", "0.60743695", "0.6049738", "0.6018456"...
0.0
-1
Callback for when everything is done
function done( status, nativeStatusText, responses, headers ) { var isSuccess, success, error, response, modified, statusText = nativeStatusText; // Called once if ( state === 2 ) { return; } // State is "done" now state = 2; // Clear timeout if it exists if ( timeoutTimer ) { clearTimeout( timeoutTimer ); } // Dereference transport for early garbage collection // (no matter how long the jqXHR object will be used) transport = undefined; // Cache response headers responseHeadersString = headers || ""; // Set readyState jqXHR.readyState = status > 0 ? 4 : 0; // Determine if successful isSuccess = status >= 200 && status < 300 || status === 304; // Get response data if ( responses ) { response = ajaxHandleResponses( s, jqXHR, responses ); } // Convert no matter what (that way responseXXX fields are always set) response = ajaxConvert( s, response, jqXHR, isSuccess ); // If successful, handle type chaining if ( isSuccess ) { // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode. if ( s.ifModified ) { modified = jqXHR.getResponseHeader("Last-Modified"); if ( modified ) { jQuery.lastModified[ cacheURL ] = modified; } modified = jqXHR.getResponseHeader("etag"); if ( modified ) { jQuery.etag[ cacheURL ] = modified; } } // if no content if ( status === 204 || s.type === "HEAD" ) { statusText = "nocontent"; // if not modified } else if ( status === 304 ) { statusText = "notmodified"; // If we have data, let's convert it } else { statusText = response.state; success = response.data; error = response.error; isSuccess = !error; } } else { // We extract error from statusText // then normalize statusText and status for non-aborts error = statusText; if ( status || !statusText ) { statusText = "error"; if ( status < 0 ) { status = 0; } } } // Set data for the fake xhr object jqXHR.status = status; jqXHR.statusText = ( nativeStatusText || statusText ) + ""; // Success/Error if ( isSuccess ) { deferred.resolveWith( callbackContext, [ success, statusText, jqXHR ] ); } else { deferred.rejectWith( callbackContext, [ jqXHR, statusText, error ] ); } // Status-dependent callbacks jqXHR.statusCode( statusCode ); statusCode = undefined; if ( fireGlobals ) { globalEventContext.trigger( isSuccess ? "ajaxSuccess" : "ajaxError", [ jqXHR, s, isSuccess ? success : error ] ); } // Complete completeDeferred.fireWith( callbackContext, [ jqXHR, statusText ] ); if ( fireGlobals ) { globalEventContext.trigger( "ajaxComplete", [ jqXHR, s ] ); // Handle the global AJAX counter if ( !( --jQuery.active ) ) { jQuery.event.trigger("ajaxStop"); } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function done() {}", "function finished(err){\n }", "onFinish() {}", "function AllDone(){\n \n}", "async onFinished() {}", "done() {}", "_onEnd() {}", "done () {}", "complete() {}", "function onFinish() {\n console.log('finished!');\n}", "function complete(){\r\n ...
[ "0.7607877", "0.73473793", "0.73289984", "0.7317956", "0.7304225", "0.72417575", "0.7235767", "0.69856775", "0.68565404", "0.6855536", "0.6845145", "0.6817738", "0.6773241", "0.6773241", "0.6773241", "0.6773241", "0.677228", "0.67654777", "0.67654777", "0.6763289", "0.6711056...
0.0
-1
Functions to create xhrs
function createStandardXHR() { try { return new window.XMLHttpRequest(); } catch( e ) {} }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function makeTime(h, i, s, ms) {\n\treturn parseInt(h, 10) * 60 * 60 \n\t\t+ parseInt(i, 10) * 60\n\t\t+ parseInt(s, 10) \n\t\t+ parseInt(ms, 10) / 1000 ;\n}", "function xToHour(x) {\n var hour = (Math.floor(times[0] + parseInt(x) / hourSpace)) % 24;\n return (hour >= 10) ? hour : \"0\" + hour;\n}", "fun...
[ "0.6773095", "0.67282486", "0.65836316", "0.6557948", "0.6520314", "0.65039384", "0.65039384", "0.65039384", "0.65039384", "0.65039384", "0.65039384", "0.65039384", "0.64763576", "0.64381844", "0.64357316", "0.64100814", "0.6404843", "0.6399019", "0.63961005", "0.6384597", "0...
0.0
-1
Gets a window from an element
function getWindow( elem ) { return jQuery.isWindow( elem ) ? elem : elem.nodeType === 9 ? elem.defaultView || elem.parentWindow : false; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getWindow(elem) {\n return jQuery.isWindow(elem) ? elem : elem.nodeType === 9 && elem.defaultView;\n }", "function getWindow(elem) {\n return jQuery.isWindow(elem) ? elem : elem.nodeType === 9 && elem.defaultView;\n }", "getWindow(editor) {\n var window = EDITOR_TO...
[ "0.6866738", "0.683033", "0.68162566", "0.68095726", "0.67838144", "0.67838144", "0.6768642", "0.675673", "0.675673", "0.675673", "0.675673", "0.67387426", "0.66907203", "0.6682642", "0.66686505", "0.6648396", "0.6642138", "0.6642138", "0.6642138", "0.6642138", "0.6642138", ...
0.0
-1
The picker constructor that creates a blank picker.
function PickerConstructor( ELEMENT, NAME, COMPONENT, OPTIONS ) { // If there’s no element, return the picker constructor. if ( !ELEMENT ) return PickerConstructor var // The state of the picker. STATE = { id: Math.abs( ~~( Math.random() * 1e9 ) ) }, // Merge the defaults and options passed. SETTINGS = COMPONENT ? $.extend( true, {}, COMPONENT.defaults, OPTIONS ) : OPTIONS || {}, // Merge the default classes with the settings classes. CLASSES = $.extend( {}, PickerConstructor.klasses(), SETTINGS.klass ), // The element node wrapper into a jQuery object. $ELEMENT = $( ELEMENT ), // Pseudo picker constructor. PickerInstance = function() { return this.start() }, // The picker prototype. P = PickerInstance.prototype = { constructor: PickerInstance, $node: $ELEMENT, /** * Initialize everything */ start: function() { // If it’s already started, do nothing. if ( STATE && STATE.start ) return P // Update the picker states. STATE.methods = {} STATE.start = true STATE.open = false STATE.type = ELEMENT.type // Confirm focus state, save original type, convert into text input // to remove UA stylings, and set as readonly to prevent keyboard popup. ELEMENT.autofocus = ELEMENT == document.activeElement ELEMENT.type = 'text' ELEMENT.readOnly = true // Create a new picker component with the settings. P.component = new COMPONENT( P, SETTINGS ) // Create the picker root with a new wrapped holder and bind the events. P.$root = $( PickerConstructor._.node( 'div', createWrappedComponent(), CLASSES.picker ) ).on({ // When something within the root is focused, stop from bubbling // to the doc and remove the “focused” state from the root. focusin: function( event ) { P.$root.removeClass( CLASSES.focused ) event.stopPropagation() }, // If the event is not on the root holder, stop it from bubbling to the doc. mousedown: function( event ) { if ( event.target != P.$root.children()[ 0 ] ) { event.stopPropagation() } }, // When something within the root holder is clicked, handle the various event. click: function( event ) { var target = event.target, $target = target.attributes.length ? $( target ) : $( target ).closest( '[data-pick]' ), targetData = $target.data() // If the event is not on the root holder itself, handle the clicks within. if ( target != P.$root.children()[ 0 ] ) { // Stop it from propagating to the doc. event.stopPropagation() // If nothing inside is actively focused, re-focus the element. if ( !$.contains( P.$root[0], document.activeElement ) ) { ELEMENT.focus() } // If something is superficially changed, update the `highlight` based on the `nav`. if ( targetData.nav && !$target.hasClass( CLASSES.navDisabled ) ) { P.set( 'highlight', P.component.item.highlight, { nav: targetData.nav } ) } // If something is picked, set `select` then close with focus. else if ( PickerConstructor._.isInteger( targetData.pick ) && !$target.hasClass( CLASSES.disabled ) ) { P.set( 'select', targetData.pick ).close( true ) } // If a “clear” button is pressed, empty the values and close with focus. else if ( targetData.clear ) { P.clear().close( true ) } } } }) //P.$root // If there’s a format for the hidden input element, create the element // using the name of the original input plus suffix. Otherwise set it to undefined. // If the element has a value, use either the `data-value` or `value`. if ( SETTINGS.formatSubmit ) { P._hidden = $( '<input type=hidden name="' + ELEMENT.name + ( SETTINGS.hiddenSuffix || '_submit' ) + '"' + ( $ELEMENT.data( 'value' ) ? ' value="' + PickerConstructor._.trigger( P.component.formats.toString, P.component, [ SETTINGS.formatSubmit, P.component.item.select ] ) + '"' : '' ) + '>' )[ 0 ] } // Add the class and bind the events on the element. $ELEMENT.addClass( CLASSES.input ). // On focus/click, open the picker and adjust the root “focused” state. on( 'focus.P' + STATE.id + ' click.P' + STATE.id, focusToOpen ). // If the value changes, update the hidden input with the correct format. on( 'change.P' + STATE.id, function() { if ( P._hidden ) { P._hidden.value = ELEMENT.value ? PickerConstructor._.trigger( P.component.formats.toString, P.component, [ SETTINGS.formatSubmit, P.component.item.select ] ) : '' } }). // Handle keyboard event based on the picker being opened or not. on( 'keydown.P' + STATE.id, function( event ) { var keycode = event.keyCode, // Check if one of the delete keys was pressed. isKeycodeDelete = /^(8|46)$/.test( keycode ) // For some reason IE clears the input value on “escape”. if ( keycode == 27 ) { P.close() return false } // Check if `space` or `delete` was pressed or the picker is closed with a key movement. if ( keycode == 32 || isKeycodeDelete || !STATE.open && P.component.key[ keycode ] ) { // Prevent it from moving the page and bubbling to doc. event.preventDefault() event.stopPropagation() // If `delete` was pressed, clear the values and close the picker. // Otherwise open the picker. if ( isKeycodeDelete ) { P.clear().close() } else { P.open() } } }). // If there’s a `data-value`, update the value of the element. val( $ELEMENT.data( 'value' ) ? PickerConstructor._.trigger( P.component.formats.toString, P.component, [ SETTINGS.format, P.component.item.select ] ) : ELEMENT.value ). // Insert the hidden input after the element. after( P._hidden ). // Store the picker data by component name. data( NAME, P ) // Insert the root as specified in the settings. if ( SETTINGS.container ) $( SETTINGS.container ).append( P.$root ) else $ELEMENT.after( P.$root ) // Bind the default component and settings events. P.on({ start: P.component.onStart, render: P.component.onRender, stop: P.component.onStop, open: P.component.onOpen, close: P.component.onClose, set: P.component.onSet }).on({ start: SETTINGS.onStart, render: SETTINGS.onRender, stop: SETTINGS.onStop, open: SETTINGS.onOpen, close: SETTINGS.onClose, set: SETTINGS.onSet }) // If the element has autofocus, open the picker. if ( ELEMENT.autofocus ) { P.open() } // Trigger queued the “start” and “render” events. return P.trigger( 'start' ).trigger( 'render' ) }, //start /** * Render a new picker */ render: function( entireComponent ) { // Insert a new component holder in the root or box. if ( entireComponent ) P.$root.html( createWrappedComponent() ) else P.$root.find( '.' + CLASSES.box ).html( P.component.nodes( STATE.open ) ) // Trigger the queued “render” events. return P.trigger( 'render' ) }, //render /** * Destroy everything */ stop: function() { // If it’s already stopped, do nothing. if ( !STATE.start ) return P // Then close the picker. P.close() // Remove the hidden field. if ( P._hidden ) { P._hidden.parentNode.removeChild( P._hidden ) } // Remove the root. P.$root.remove() // Remove the input class, unbind the events, and remove the stored data. $ELEMENT.removeClass( CLASSES.input ).off( '.P' + STATE.id ).removeData( NAME ) // Restore the element state ELEMENT.type = STATE.type ELEMENT.readOnly = false // Trigger the queued “stop” events. P.trigger( 'stop' ) // Reset the picker states. STATE.methods = {} STATE.start = false return P }, //stop /* * Open up the picker */ open: function( dontGiveFocus ) { // If it’s already open, do nothing. if ( STATE.open ) return P // Add the “active” class. $ELEMENT.addClass( CLASSES.active ) // Add the “opened” class to the picker root. P.$root.addClass( CLASSES.opened ) // If we have to give focus, bind the element and doc events. if ( dontGiveFocus !== false ) { // Set it as open. STATE.open = true // Pass focus to the element’s jQuery object. $ELEMENT.focus() // Bind the document events. $document.on( 'click.P' + STATE.id + ' focusin.P' + STATE.id, function( event ) { // If the target of the event is not the element, close the picker picker. // * Don’t worry about clicks or focusins on the root because those don’t bubble up. // Also, for Firefox, a click on an `option` element bubbles up directly // to the doc. So make sure the target wasn't the doc. if ( event.target != ELEMENT && event.target != document ) P.close() }).on( 'keydown.P' + STATE.id, function( event ) { var // Get the keycode. keycode = event.keyCode, // Translate that to a selection change. keycodeToMove = P.component.key[ keycode ], // Grab the target. target = event.target // On escape, close the picker and give focus. if ( keycode == 27 ) { P.close( true ) } // Check if there is a key movement or “enter” keypress on the element. else if ( target == ELEMENT && ( keycodeToMove || keycode == 13 ) ) { // Prevent the default action to stop page movement. event.preventDefault() // Trigger the key movement action. if ( keycodeToMove ) { PickerConstructor._.trigger( P.component.key.go, P, [ keycodeToMove ] ) } // On “enter”, if the highlighted item isn’t disabled, set the value and close. else if ( !P.$root.find( '.' + CLASSES.highlighted ).hasClass( CLASSES.disabled ) ) { P.set( 'select', P.component.item.highlight ).close() } } // If the target is within the root and “enter” is pressed, // prevent the default action and trigger a click on the target instead. else if ( $.contains( P.$root[0], target ) && keycode == 13 ) { event.preventDefault() target.click() } }) } // Trigger the queued “open” events. return P.trigger( 'open' ) }, //open /** * Close the picker */ close: function( giveFocus ) { // If we need to give focus, do it before changing states. if ( giveFocus ) { // ....ah yes! It would’ve been incomplete without a crazy workaround for IE :| // The focus is triggered *after* the close has completed - causing it // to open again. So unbind and rebind the event at the next tick. $ELEMENT.off( 'focus.P' + STATE.id ).focus() setTimeout( function() { $ELEMENT.on( 'focus.P' + STATE.id, focusToOpen ) }, 0 ) } // Remove the “active” class. $ELEMENT.removeClass( CLASSES.active ) // Remove the “opened” and “focused” class from the picker root. P.$root.removeClass( CLASSES.opened + ' ' + CLASSES.focused ) // If it’s open, update the state. if ( STATE.open ) { // Set it as closed. STATE.open = false // Unbind the document events. $document.off( '.P' + STATE.id ) } // Trigger the queued “close” events. return P.trigger( 'close' ) }, //close /** * Clear the values */ clear: function() { return P.set( 'clear' ) }, //clear /** * Set something */ set: function( thing, value, options ) { var thingItem, thingValue, thingIsObject = PickerConstructor._.isObject( thing ), thingObject = thingIsObject ? thing : {} if ( thing ) { // If the thing isn’t an object, make it one. if ( !thingIsObject ) { thingObject[ thing ] = value } // Go through the things of items to set. for ( thingItem in thingObject ) { // Grab the value of the thing. thingValue = thingObject[ thingItem ] // First, if the item exists and there’s a value, set it. if ( P.component.item[ thingItem ] ) { P.component.set( thingItem, thingValue, options || {} ) } // Then, check to update the element value and broadcast a change. if ( thingItem == 'select' || thingItem == 'clear' ) { $ELEMENT.val( thingItem == 'clear' ? '' : PickerConstructor._.trigger( P.component.formats.toString, P.component, [ SETTINGS.format, P.component.get( thingItem ) ] ) ).trigger( 'change' ) } } // Render a new picker. P.render() } // Trigger queued “set” events and pass the `thingObject`. return P.trigger( 'set', thingObject ) }, //set /** * Get something */ get: function( thing, format ) { // Make sure there’s something to get. thing = thing || 'value' // If a picker state exists, return that. if ( STATE[ thing ] != null ) { return STATE[ thing ] } // Return the value, if that. if ( thing == 'value' ) { return ELEMENT.value } // Check if a component item exists, return that. if ( P.component.item[ thing ] ) { if ( typeof format == 'string' ) { return PickerConstructor._.trigger( P.component.formats.toString, P.component, [ format, P.component.get( thing ) ] ) } return P.component.get( thing ) } }, //get /** * Bind events on the things. */ on: function( thing, method ) { var thingName, thingMethod, thingIsObject = PickerConstructor._.isObject( thing ), thingObject = thingIsObject ? thing : {} if ( thing ) { // If the thing isn’t an object, make it one. if ( !thingIsObject ) { thingObject[ thing ] = method } // Go through the things to bind to. for ( thingName in thingObject ) { // Grab the method of the thing. thingMethod = thingObject[ thingName ] // Make sure the thing methods collection exists. STATE.methods[ thingName ] = STATE.methods[ thingName ] || [] // Add the method to the relative method collection. STATE.methods[ thingName ].push( thingMethod ) } } return P }, //on /** * Fire off method events. */ trigger: function( name, data ) { var methodList = STATE.methods[ name ] if ( methodList ) { methodList.map( function( method ) { PickerConstructor._.trigger( method, P, [ data ] ) }) } return P } //trigger } //PickerInstance.prototype /** * Wrap the picker holder components together. */ function createWrappedComponent() { // Create a picker wrapper holder return PickerConstructor._.node( 'div', // Create a picker wrapper node PickerConstructor._.node( 'div', // Create a picker frame PickerConstructor._.node( 'div', // Create a picker box node PickerConstructor._.node( 'div', // Create the components nodes. P.component.nodes( STATE.open ), // The picker box class CLASSES.box ), // Picker wrap class CLASSES.wrap ), // Picker frame class CLASSES.frame ), // Picker holder class CLASSES.holder ) //endreturn } //createWrappedComponent // Separated for IE function focusToOpen( event ) { // Stop the event from propagating to the doc. event.stopPropagation() // If it’s a focus event, add the “focused” class to the root. if ( event.type == 'focus' ) P.$root.addClass( CLASSES.focused ) // And then finally open the picker. P.open() } // Return a new picker instance. return new PickerInstance() }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function Picker( ){}", "function PickerConstructor( ELEMENT, NAME, COMPONENT, OPTIONS ) {\n\n // If there’s no element, return the picker constructor.\n if ( !ELEMENT ) return PickerConstructor\n\n\n var\n // The state of the picker.\n STATE = {\n id: Math.abs( ~~( Math.random()...
[ "0.73651254", "0.73627025", "0.72273475", "0.7188923", "0.7188923", "0.7173508", "0.7153464", "0.7153414", "0.7153414", "0.7153414", "0.7153414", "0.7153414", "0.71443874", "0.71443874", "0.71443874", "0.6972573", "0.67295325", "0.6702664", "0.6507749", "0.6386553", "0.637774...
0.73366165
2
PickerInstance.prototype Wrap the picker holder components together.
function createWrappedComponent() { // Create a picker wrapper holder return PickerConstructor._.node( 'div', // Create a picker wrapper node PickerConstructor._.node( 'div', // Create a picker frame PickerConstructor._.node( 'div', // Create a picker box node PickerConstructor._.node( 'div', // Create the components nodes. P.component.nodes( STATE.open ), // The picker box class CLASSES.box ), // Picker wrap class CLASSES.wrap ), // Picker frame class CLASSES.frame ), // Picker holder class CLASSES.holder ) //endreturn } //createWrappedComponent
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function createWrappedComponent() {\n\n // Create a picker wrapper holder\n return PickerConstructor._.node( 'div',\n\n // Create a picker wrapper node\n PickerConstructor._.node( 'div',\n\n // Create a picker frame\n PickerConstructor._.node( 'div'...
[ "0.70671076", "0.70671076", "0.70671076", "0.7055872", "0.7055872", "0.7055872", "0.7055872", "0.7055872", "0.69563127", "0.6948545", "0.689753", "0.68825334", "0.6768623", "0.6754687", "0.67472017", "0.67472017", "0.6734763", "0.6654615", "0.6654615", "0.6654615", "0.6654615...
0.7020631
8
The date picker constructor
function DatePicker( picker, settings ) { var calendar = this, elementValue = picker.$node[ 0 ].value, elementDataValue = picker.$node.data( 'value' ), valueString = elementDataValue || elementValue, formatString = elementDataValue ? settings.formatSubmit : settings.format calendar.settings = settings // The queue of methods that will be used to build item objects. calendar.queue = { min: 'measure create', max: 'measure create', now: 'now create', select: 'parse create validate', highlight: 'navigate create validate', view: 'create validate viewset', disable: 'flipItem', enable: 'flipItem' } // The component's item object. calendar.item = {} calendar.item.disable = ( settings.disable || [] ).slice( 0 ) calendar.item.enable = -(function( collectionDisabled ) { return collectionDisabled[ 0 ] === true ? collectionDisabled.shift() : -1 })( calendar.item.disable ) calendar. set( 'min', settings.min ). set( 'max', settings.max ). set( 'now' ). // Setting the `select` also sets the `highlight` and `view`. set( 'select', // Use the value provided or default to selecting “today”. valueString || calendar.item.now, { // Use the appropriate format. format: formatString, // Set user-provided month data as true when there is a // “mm” or “m” used in the relative format string. data: (function( formatArray ) { return valueString && ( formatArray.indexOf( 'mm' ) > -1 || formatArray.indexOf( 'm' ) > -1 ) })( calendar.formats.toArray( formatString ) ) } ) // The keycode to movement mapping. calendar.key = { 40: 7, // Down 38: -7, // Up 39: 1, // Right 37: -1, // Left go: function( timeChange ) { calendar.set( 'highlight', [ calendar.item.highlight.year, calendar.item.highlight.month, calendar.item.highlight.date + timeChange ], { interval: timeChange } ) this.render() } } // Bind some picker events. picker. on( 'render', function() { picker.$root.find( '.' + settings.klass.selectMonth ).on( 'change', function() { picker.set( 'highlight', [ picker.get( 'view' ).year, this.value, picker.get( 'highlight' ).date ] ) picker.$root.find( '.' + settings.klass.selectMonth ).focus() }) picker.$root.find( '.' + settings.klass.selectYear ).on( 'change', function() { picker.set( 'highlight', [ this.value, picker.get( 'view' ).month, picker.get( 'highlight' ).date ] ) picker.$root.find( '.' + settings.klass.selectYear ).focus() }) }). on( 'open', function() { picker.$root.find( 'button, select' ).attr( 'disabled', false ) }). on( 'close', function() { picker.$root.find( 'button, select' ).attr( 'disabled', true ) }) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function Datepicker() {}", "function Datepicker() {}", "function createDatePickerComponent() {\n $(\"#datepicker\").datepicker({\n format: \"yyyy-mm-dd\",\n language: \"fr\",\n autoclose: true,\n clearBtn: true,\n todayHighlight: true,\n todayBtn: \"linked\"\n })...
[ "0.8324266", "0.8324266", "0.7517829", "0.74593496", "0.7454787", "0.7446813", "0.7442016", "0.7440107", "0.74231875", "0.7421519", "0.7421166", "0.7421166", "0.7421166", "0.7421166", "0.7421166", "0.7421166", "0.7421166", "0.7421166", "0.7421166", "0.74110496", "0.74110496",...
0.0
-1
Return the length of the first word in a collection.
function getWordLengthFromCollection( string, collection, dateObject ) { // Grab the first word from the string. var word = string.match( /\w+/ )[ 0 ] // If there's no month index, add it to the date object if ( !dateObject.mm && !dateObject.m ) { dateObject.m = collection.indexOf( word ) } // Return the length of the word. return word.length }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getWordLengthFromCollection( string, collection, dateObject ) { // 5711\n // 5712\n // Grab the first word from the string. ...
[ "0.72159755", "0.7192056", "0.711952", "0.711952", "0.711952", "0.70963985", "0.70963985", "0.70963985", "0.70963985", "0.70518595", "0.70490915", "0.70490915", "0.70490915", "0.70084614", "0.6901988", "0.6901988", "0.6901988", "0.68875146", "0.68875146", "0.68875146", "0.688...
0.708546
9
Get the length of the first word in a string.
function getFirstWordLength( string ) { return string.match( /\w+/ )[ 0 ].length }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getFirstWordLength( string ) {\n\t return string.match( /\\w+/ )[ 0 ].length\n\t }", "function getFirstWordLength(string) {\r\n return string.match(/\\w+/)[0].length;\r\n }", "function getFirstWordLength(string) {\n return string.match(/\\w+/)[0].length;\n }", "function get...
[ "0.89729446", "0.8942837", "0.8938594", "0.8938594", "0.8938594", "0.8706707", "0.7410752", "0.73234475", "0.7192478", "0.70214313", "0.69959456", "0.69958895", "0.6929939", "0.69265574", "0.69213504", "0.6918947", "0.6915867", "0.6915867", "0.6915867", "0.69077176", "0.68973...
0.90240616
6
The time picker constructor
function TimePicker( picker, settings ) { var clock = this, elementDataValue = picker.$node.data( 'value' ) clock.settings = settings // The queue of methods that will be used to build item objects. clock.queue = { interval: 'i', min: 'measure create', max: 'measure create', now: 'now create', select: 'parse create validate', highlight: 'create validate', view: 'create validate', disable: 'flipItem', enable: 'flipItem' } // The component's item object. clock.item = {} clock.item.interval = settings.interval || 30 clock.item.disable = ( settings.disable || [] ).slice( 0 ) clock.item.enable = -(function( collectionDisabled ) { return collectionDisabled[ 0 ] === true ? collectionDisabled.shift() : -1 })( clock.item.disable ) clock. set( 'min', settings.min ). set( 'max', settings.max ). set( 'now' ). // Setting the `select` also sets the `highlight` and `view`. set( 'select', // If there's a `value` or `data-value`, use that with formatting. // Otherwise default to the minimum selectable time. elementDataValue || picker.$node[ 0 ].value || clock.item.min, // Use the relevant format. { format: elementDataValue ? settings.formatSubmit : settings.format } ) // The keycode to movement mapping. clock.key = { 40: 1, // Down 38: -1, // Up 39: 1, // Right 37: -1, // Left go: function( timeChange ) { clock.set( 'highlight', clock.item.highlight.pick + timeChange * clock.item.interval, { interval: timeChange * clock.item.interval } ) this.render() } } // Bind some picker events. picker. on( 'render', function() { var $pickerHolder = picker.$root.children(), $viewset = $pickerHolder.find( '.' + settings.klass.viewset ) if ( $viewset.length ) { $pickerHolder[ 0 ].scrollTop = ~~( $viewset.position().top - ( $viewset[ 0 ].clientHeight * 2 ) ) } else { console.warn( 'Nothing to viewset with', clock.item.view ) } }). on( 'open', function() { picker.$root.find( 'button' ).attr( 'disable', false ) }). on( 'close', function() { picker.$root.find( 'button' ).attr( 'disable', true ) }) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function Timepicker()\n {\n this.debug = true; // Change this to true to start debugging\n this._curInst = null; // The current instance in use\n this._isInline = false; // true if the instance is displayed inline\n this._disabledInputs = []; // List of time picker inputs that have b...
[ "0.7654261", "0.7525277", "0.7259207", "0.7259207", "0.72343695", "0.72307056", "0.6982464", "0.6832831", "0.6822157", "0.6813999", "0.68011254", "0.66592133", "0.6658957", "0.6566012", "0.6540716", "0.653251", "0.6532083", "0.6516161", "0.64831614", "0.63579524", "0.6326302"...
0.7096579
6
function for adding/overriding defaults
function setDefaults(d) { $.extend(true, defaults, d); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "defaults () {\n }", "function setDefaults(src, dst) {\n if (src === undefined || isEmpty(src)) {\n throw new Error('No DEFAULTS passed');\n }\n if (dst === undefined) {\n throw new Error('No dst passed');\n }\n\n // Remember defaults for future reference\n DEFAULTS = src;\n\n // H...
[ "0.6910572", "0.6873537", "0.68103474", "0.6782485", "0.6720342", "0.6668518", "0.6658312", "0.6632388", "0.6632388", "0.66272813", "0.6624439", "0.6557122", "0.6526781", "0.65229905", "0.6458429", "0.6458429", "0.6458429", "0.643058", "0.64103925", "0.64103925", "0.64103925"...
0.6897513
2
called when we know the calendar couldn't be rendered when it was initialized, but we think it's ready now
function lateRender() { setTimeout(function() { // IE7 needs this so dimensions are calculated correctly if (!currentView.start && bodyVisible()) { // !currentView.start makes sure this never happens more than once renderView(); } },0); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function eventsInitialRender() {\n //remove selection if it's there\n localStorage.setItem(\"mainContentCalendarSelectedCrn\", \"\");\n\n //manageClasses page\n if (document.getElementById(\"mc_manageClasses_input_crn\")) {\n manageClasses_eventsInitialRender();\n }\n\n //assign professors...
[ "0.6675112", "0.6532627", "0.64996254", "0.6390678", "0.6381421", "0.6369659", "0.6366857", "0.6336226", "0.6334968", "0.6262136", "0.621878", "0.61944467", "0.6163097", "0.6140803", "0.6124754", "0.6047895", "0.60225683", "0.60166717", "0.6012465", "0.597106", "0.59669775", ...
0.57753384
54
Event Fetching/Rendering TODO: going forward, most of this stuff should be directly handled by the view
function refetchEvents() { // can be called as an API method clearEvents(); fetchAndRenderEvents(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function RenderEvent() {}", "getEventsToRender() {}", "function refetchEvents() { // can be called as an API method\n\t\t\tfetchAndRenderEvents();\n\t\t}", "function refetchEvents() { // can be called as an API method\n\t\tfetchAndRenderEvents();\n\t}", "function reportEventChange() {\n renderEv...
[ "0.7301492", "0.7227738", "0.69588", "0.68859994", "0.6742137", "0.673206", "0.67125857", "0.6540284", "0.6511065", "0.64929575", "0.64361346", "0.64361346", "0.64361346", "0.6414266", "0.6414266", "0.6378302", "0.6363302", "0.63520485", "0.63474816", "0.63474816", "0.6240542...
0.62820274
23
called when event data arrives
function reportEvents(_events) { events = _events; renderEvents(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function onEvent(type, data) {\n eventsBuffer.push({type: type, data: data});\n }", "listenForData() {\n this.socket.on(EVENT_DATA, data => this.handleData(data))\n }", "function onData(event) {\n\t\tif(event.getSubject() != '/pushlet/ping') {\n\t\t\tif(event.getSubject() == 'system_online') {\n\t\...
[ "0.7055481", "0.6987813", "0.6892565", "0.679343", "0.6654351", "0.6635153", "0.65831125", "0.6583068", "0.65614724", "0.65514517", "0.65429336", "0.65359074", "0.65340936", "0.64733493", "0.6466211", "0.6440642", "0.6440168", "0.64191616", "0.64180887", "0.63989305", "0.6398...
0.0
-1
called when a single event's data has been changed
function reportEventChange(eventID) { rerenderEvents(eventID); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "onDataChange() {}", "notifyDataChanged() {\n this.hasDataChangesProperty = true;\n this.dataChanged.raiseEvent();\n }", "function changeDataHandler(event) {\n\n const divid = document.getElementById(event.target.id);\n //needs to be a constant value or works off resized values\n divid...
[ "0.7141103", "0.70413023", "0.6659295", "0.66524935", "0.6592736", "0.65476274", "0.653258", "0.6525979", "0.6517237", "0.6468771", "0.6407931", "0.637106", "0.6322176", "0.6297184", "0.6294713", "0.62893534", "0.6286527", "0.62627655", "0.62482697", "0.62353003", "0.6213826"...
0.0
-1
Date Formatting TODO: use same function formatDate(date, [date2], format, [options])
function formatDate(date, format, options) { return formatDates(date, null, format, options); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function formatDate(date, format){\n if(!date){\n return '0000-00-00';\n }\n var dd = date.substring(0, 2);\n var mm = date.substring(3, 5);\n var yy = date.substring(6);\n if (format == 'dmy') {\n return dd + '-' + mm + '-' + yy;\n } else {\n...
[ "0.7012748", "0.69397384", "0.6936459", "0.69123596", "0.68826747", "0.68826747", "0.68826747", "0.68826747", "0.68826747", "0.6882154", "0.68381953", "0.6758893", "0.67564595", "0.674587", "0.6669971", "0.66589844", "0.6653689", "0.663809", "0.663248", "0.66087043", "0.65712...
0.7590613
1
thanks jQuery UI ( Set as calculateWeek to determine the week of the year based on the ISO 8601 definition. `date` the date to get the week for `number` the number of the week within the year that contains this date
function iso8601Week(date) { var time; var checkDate = new Date(date.getTime()); // Find Thursday of this week starting on Monday checkDate.setDate(checkDate.getDate() + 4 - (checkDate.getDay() || 7)); time = checkDate.getTime(); checkDate.setMonth(0); // Compare with Jan 1 checkDate.setDate(1); return Math.floor(Math.round((time - checkDate) / 86400000) / 7) + 1; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "w (date) {\n return getWeekOfYear(date)\n }", "function _weekNumber(date) {\r\n var ytd = toNumber(date.strftime(\"%j\"));\r\n var week = Math.floor(ytd/7);\r\n if (new Date(date.getFullYear(), 0, 1).getDay() < 4) {\r\n week++;\r\n }\r\n return week;\r\n}", "function getWeekNumber(date) {\r va...
[ "0.7750951", "0.72916156", "0.72112733", "0.70495445", "0.7044447", "0.702769", "0.69059986", "0.69059986", "0.6828386", "0.66770184", "0.6551629", "0.64467746", "0.6425835", "0.6399251", "0.63968956", "0.63956755", "0.63862133", "0.63830954", "0.63415", "0.63293123", "0.6264...
0.6550435
12
Misc Utils TODO: arraySlice TODO: isFunction, grep ?
function noop() { }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function ArrayUtils() {}", "function sliceMe(tempArr,start,end){\r\n return tempArr.slice(start,end);\r\n\r\n }", "function slice$1$1(thing) {\n\t return Array.prototype.slice.call(thing);\n\t}", "function UnifyingSlice() {\n}", "function s...
[ "0.6910871", "0.6876547", "0.67718166", "0.66999435", "0.6663274", "0.6661269", "0.6661269", "0.65695167", "0.6491246", "0.6481248", "0.64620954", "0.635887", "0.6290753", "0.62858766", "0.6181474", "0.6136944", "0.6103522", "0.60000294", "0.5964707", "0.5927289", "0.59239495...
0.0
-1
Day clicking and binding
function dayBind(days) { days.click(dayClick) .mousedown(daySelectionMousedown); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function dayBind(days) {\n\t\tdays.click(dayClick).mousedown(daySelectionMousedown);\n\t}", "function dayClick(date, jsEvent, view)\n {\n\n alert('Clicked on: ' + date.format());\n\n // alert('Coordinates: ' + jsEvent.pageX + ',' + jsEvent.pageY);\n\n // alert('Current view: ' + view.name...
[ "0.7444935", "0.70842844", "0.67582387", "0.6702769", "0.6702769", "0.6702769", "0.6702769", "0.6702769", "0.6647051", "0.6600649", "0.657175", "0.6562877", "0.6552059", "0.6375962", "0.630387", "0.629875", "0.628525", "0.6282149", "0.6250555", "0.622633", "0.61449313", "0....
0.733706
4
Semitransparent Overlay Helpers TODO: should be consolidated with AgendaView's methods
function renderDayOverlay(overlayStart, overlayEnd, refreshCoordinateGrid) { // overlayEnd is exclusive if (refreshCoordinateGrid) { coordinateGrid.build(); } var segments = rangeToSegments(overlayStart, overlayEnd); for (var i=0; i<segments.length; i++) { var segment = segments[i]; dayBind( renderCellOverlay( segment.row, segment.leftCol, segment.row, segment.rightCol ) ); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "showTransparentOverlay() {\n this.$transparentOverlay.show();\n }", "'transparent'(callback) {\n\t\tthis.style('opacity', 0, callback);\n\t}", "function overlay() {\n sketch.strokeWeight(1);\n sketch.stroke(0, 0, 255, 75);\n sketch.fill(0, 0, 255, 75);\n sketch.rectMode(sketch.C...
[ "0.67621166", "0.65045995", "0.63571864", "0.61678684", "0.6148453", "0.60853624", "0.5982282", "0.59695154", "0.5936959", "0.5910352", "0.58961415", "0.58945423", "0.5883291", "0.58774596", "0.5855968", "0.5850759", "0.5808216", "0.57763964", "0.57609516", "0.5758845", "0.57...
0.0
-1
TODO: make it work in quirks mode (event corners, allday height) TODO: test liquid width, especially in IE6
function AgendaView(element, calendar, viewName) { var t = this; // exports t.renderAgenda = renderAgenda; t.setWidth = setWidth; t.setHeight = setHeight; t.afterRender = afterRender; t.defaultEventEnd = defaultEventEnd; t.timePosition = timePosition; t.getIsCellAllDay = getIsCellAllDay; t.allDayRow = getAllDayRow; t.getCoordinateGrid = function() { return coordinateGrid }; // specifically for AgendaEventRenderer t.getHoverListener = function() { return hoverListener }; t.colLeft = colLeft; t.colRight = colRight; t.colContentLeft = colContentLeft; t.colContentRight = colContentRight; t.getDaySegmentContainer = function() { return daySegmentContainer }; t.getSlotSegmentContainer = function() { return slotSegmentContainer }; t.getMinMinute = function() { return minMinute }; t.getMaxMinute = function() { return maxMinute }; t.getSlotContainer = function() { return slotContainer }; t.getRowCnt = function() { return 1 }; t.getColCnt = function() { return colCnt }; t.getColWidth = function() { return colWidth }; t.getSnapHeight = function() { return snapHeight }; t.getSnapMinutes = function() { return snapMinutes }; t.defaultSelectionEnd = defaultSelectionEnd; t.renderDayOverlay = renderDayOverlay; t.renderSelection = renderSelection; t.clearSelection = clearSelection; t.reportDayClick = reportDayClick; // selection mousedown hack t.dragStart = dragStart; t.dragStop = dragStop; // imports View.call(t, element, calendar, viewName); OverlayManager.call(t); SelectionManager.call(t); AgendaEventRenderer.call(t); var opt = t.opt; var trigger = t.trigger; var renderOverlay = t.renderOverlay; var clearOverlays = t.clearOverlays; var reportSelection = t.reportSelection; var unselect = t.unselect; var daySelectionMousedown = t.daySelectionMousedown; var slotSegHtml = t.slotSegHtml; var cellToDate = t.cellToDate; var dateToCell = t.dateToCell; var rangeToSegments = t.rangeToSegments; var formatDate = calendar.formatDate; // locals var dayTable; var dayHead; var dayHeadCells; var dayBody; var dayBodyCells; var dayBodyCellInners; var dayBodyCellContentInners; var dayBodyFirstCell; var dayBodyFirstCellStretcher; var slotLayer; var daySegmentContainer; var allDayTable; var allDayRow; var slotScroller; var slotContainer; var slotSegmentContainer; var slotTable; var selectionHelper; var viewWidth; var viewHeight; var axisWidth; var colWidth; var gutterWidth; var slotHeight; // TODO: what if slotHeight changes? (see issue 650) var snapMinutes; var snapRatio; // ratio of number of "selection" slots to normal slots. (ex: 1, 2, 4) var snapHeight; // holds the pixel hight of a "selection" slot var colCnt; var slotCnt; var coordinateGrid; var hoverListener; var colPositions; var colContentPositions; var slotTopCache = {}; var tm; var rtl; var minMinute, maxMinute; var colFormat; var showWeekNumbers; var weekNumberTitle; var weekNumberFormat; /* Rendering -----------------------------------------------------------------------------*/ disableTextSelection(element.addClass('fc-agenda')); function renderAgenda(c) { colCnt = c; updateOptions(); if (!dayTable) { // first time rendering? buildSkeleton(); // builds day table, slot area, events containers } else { buildDayTable(); // rebuilds day table } } function updateOptions() { tm = opt('theme') ? 'ui' : 'fc'; rtl = opt('isRTL') minMinute = parseTime(opt('minTime')); maxMinute = parseTime(opt('maxTime')); colFormat = opt('columnFormat'); // week # options. (TODO: bad, logic also in other views) showWeekNumbers = opt('weekNumbers'); weekNumberTitle = opt('weekNumberTitle'); if (opt('weekNumberCalculation') != 'iso') { weekNumberFormat = "w"; } else { weekNumberFormat = "W"; } snapMinutes = opt('snapMinutes') || opt('slotMinutes'); } /* Build DOM -----------------------------------------------------------------------*/ function buildSkeleton() { var headerClass = tm + "-widget-header"; var contentClass = tm + "-widget-content"; var s; var d; var i; var maxd; var minutes; var slotNormal = opt('slotMinutes') % 15 == 0; buildDayTable(); slotLayer = $("<div style='position:absolute;z-index:2;left:0;width:100%'/>") .appendTo(element); if (opt('allDaySlot')) { daySegmentContainer = $("<div class='fc-event-container' style='position:absolute;z-index:8;top:0;left:0'/>") .appendTo(slotLayer); s = "<table style='width:100%' class='fc-agenda-allday' cellspacing='0'>" + "<tr>" + "<th class='" + headerClass + " fc-agenda-axis'>" + opt('allDayText') + "</th>" + "<td>" + "<div class='fc-day-content'><div style='position:relative'/></div>" + "</td>" + "<th class='" + headerClass + " fc-agenda-gutter'>&nbsp;</th>" + "</tr>" + "</table>"; allDayTable = $(s).appendTo(slotLayer); allDayRow = allDayTable.find('tr'); dayBind(allDayRow.find('td')); slotLayer.append( "<div class='fc-agenda-divider " + headerClass + "'>" + "<div class='fc-agenda-divider-inner'/>" + "</div>" ); }else{ daySegmentContainer = $([]); // in jQuery 1.4, we can just do $() } slotScroller = $("<div style='position:absolute;width:100%;overflow-x:hidden;overflow-y:auto'/>") .appendTo(slotLayer); slotContainer = $("<div style='position:relative;width:100%;overflow:hidden'/>") .appendTo(slotScroller); slotSegmentContainer = $("<div class='fc-event-container' style='position:absolute;z-index:8;top:0;left:0'/>") .appendTo(slotContainer); s = "<table class='fc-agenda-slots' style='width:100%' cellspacing='0'>" + "<tbody>"; d = zeroDate(); maxd = addMinutes(cloneDate(d), maxMinute); addMinutes(d, minMinute); slotCnt = 0; for (i=0; d < maxd; i++) { minutes = d.getMinutes(); s += "<tr class='fc-slot" + i + ' ' + (!minutes ? '' : 'fc-minor') + "'>" + "<th class='fc-agenda-axis " + headerClass + "'>" + ((!slotNormal || !minutes) ? formatDate(d, opt('axisFormat')) : '&nbsp;') + "</th>" + "<td class='" + contentClass + "'>" + "<div style='position:relative'>&nbsp;</div>" + "</td>" + "</tr>"; addMinutes(d, opt('slotMinutes')); slotCnt++; } s += "</tbody>" + "</table>"; slotTable = $(s).appendTo(slotContainer); slotBind(slotTable.find('td')); } /* Build Day Table -----------------------------------------------------------------------*/ function buildDayTable() { var html = buildDayTableHTML(); if (dayTable) { dayTable.remove(); } dayTable = $(html).appendTo(element); dayHead = dayTable.find('thead'); dayHeadCells = dayHead.find('th').slice(1, -1); // exclude gutter dayBody = dayTable.find('tbody'); dayBodyCells = dayBody.find('td').slice(0, -1); // exclude gutter dayBodyCellInners = dayBodyCells.find('> div'); dayBodyCellContentInners = dayBodyCells.find('.fc-day-content > div'); dayBodyFirstCell = dayBodyCells.eq(0); dayBodyFirstCellStretcher = dayBodyCellInners.eq(0); markFirstLast(dayHead.add(dayHead.find('tr'))); markFirstLast(dayBody.add(dayBody.find('tr'))); // TODO: now that we rebuild the cells every time, we should call dayRender } function buildDayTableHTML() { var html = "<table style='width:100%' class='fc-agenda-days fc-border-separate' cellspacing='0'>" + buildDayTableHeadHTML() + buildDayTableBodyHTML() + "</table>"; return html; } function buildDayTableHeadHTML() { var headerClass = tm + "-widget-header"; var date; var html = ''; var weekText; var col; html += "<thead>" + "<tr>"; if (showWeekNumbers) { date = cellToDate(0, 0); weekText = formatDate(date, weekNumberFormat); if (rtl) { weekText += weekNumberTitle; } else { weekText = weekNumberTitle + weekText; } html += "<th class='fc-agenda-axis fc-week-number " + headerClass + "'>" + htmlEscape(weekText) + "</th>"; } else { html += "<th class='fc-agenda-axis " + headerClass + "'>&nbsp;</th>"; } for (col=0; col<colCnt; col++) { date = cellToDate(0, col); html += "<th class='fc-" + dayIDs[date.getDay()] + " fc-col" + col + ' ' + headerClass + "'>" + htmlEscape(formatDate(date, colFormat)) + "</th>"; } html += "<th class='fc-agenda-gutter " + headerClass + "'>&nbsp;</th>" + "</tr>" + "</thead>"; return html; } function buildDayTableBodyHTML() { var headerClass = tm + "-widget-header"; // TODO: make these when updateOptions() called var contentClass = tm + "-widget-content"; var date; var today = clearTime(new Date()); var col; var cellsHTML; var cellHTML; var classNames; var html = ''; html += "<tbody>" + "<tr>" + "<th class='fc-agenda-axis " + headerClass + "'>&nbsp;</th>"; cellsHTML = ''; for (col=0; col<colCnt; col++) { date = cellToDate(0, col); classNames = [ 'fc-col' + col, 'fc-' + dayIDs[date.getDay()], contentClass ]; if (+date == +today) { classNames.push( tm + '-state-highlight', 'fc-today' ); } else if (date < today) { classNames.push('fc-past'); } else { classNames.push('fc-future'); } cellHTML = "<td class='" + classNames.join(' ') + "'>" + "<div>" + "<div class='fc-day-content'>" + "<div style='position:relative'>&nbsp;</div>" + "</div>" + "</div>" + "</td>"; cellsHTML += cellHTML; } html += cellsHTML; html += "<td class='fc-agenda-gutter " + contentClass + "'>&nbsp;</td>" + "</tr>" + "</tbody>"; return html; } // TODO: data-date on the cells /* Dimensions -----------------------------------------------------------------------*/ function setHeight(height) { if (height === undefined) { height = viewHeight; } viewHeight = height; slotTopCache = {}; var headHeight = dayBody.position().top; var allDayHeight = slotScroller.position().top; // including divider var bodyHeight = Math.min( // total body height, including borders height - headHeight, // when scrollbars slotTable.height() + allDayHeight + 1 // when no scrollbars. +1 for bottom border ); dayBodyFirstCellStretcher .height(bodyHeight - vsides(dayBodyFirstCell)); slotLayer.css('top', headHeight); slotScroller.height(bodyHeight - allDayHeight - 1); // the stylesheet guarantees that the first row has no border. // this allows .height() to work well cross-browser. slotHeight = slotTable.find('tr:first').height() + 1; // +1 for bottom border snapRatio = opt('slotMinutes') / snapMinutes; snapHeight = slotHeight / snapRatio; } function setWidth(width) { viewWidth = width; colPositions.clear(); colContentPositions.clear(); var axisFirstCells = dayHead.find('th:first'); if (allDayTable) { axisFirstCells = axisFirstCells.add(allDayTable.find('th:first')); } axisFirstCells = axisFirstCells.add(slotTable.find('th:first')); axisWidth = 0; setOuterWidth( axisFirstCells .width('') .each(function(i, _cell) { axisWidth = Math.max(axisWidth, $(_cell).outerWidth()); }), axisWidth ); var gutterCells = dayTable.find('.fc-agenda-gutter'); if (allDayTable) { gutterCells = gutterCells.add(allDayTable.find('th.fc-agenda-gutter')); } var slotTableWidth = slotScroller[0].clientWidth; // needs to be done after axisWidth (for IE7) gutterWidth = slotScroller.width() - slotTableWidth; if (gutterWidth) { setOuterWidth(gutterCells, gutterWidth); gutterCells .show() .prev() .removeClass('fc-last'); }else{ gutterCells .hide() .prev() .addClass('fc-last'); } colWidth = Math.floor((slotTableWidth - axisWidth) / colCnt); setOuterWidth(dayHeadCells.slice(0, -1), colWidth); } /* Scrolling -----------------------------------------------------------------------*/ function resetScroll() { var d0 = zeroDate(); var scrollDate = cloneDate(d0); scrollDate.setHours(opt('firstHour')); var top = timePosition(d0, scrollDate) + 1; // +1 for the border function scroll() { slotScroller.scrollTop(top); } scroll(); setTimeout(scroll, 0); // overrides any previous scroll state made by the browser } function afterRender() { // after the view has been freshly rendered and sized resetScroll(); } /* Slot/Day clicking and binding -----------------------------------------------------------------------*/ function dayBind(cells) { cells.click(slotClick) .mousedown(daySelectionMousedown); } function slotBind(cells) { cells.click(slotClick) .mousedown(slotSelectionMousedown); } function slotClick(ev) { if (!opt('selectable')) { // if selectable, SelectionManager will worry about dayClick var col = Math.min(colCnt-1, Math.floor((ev.pageX - dayTable.offset().left - axisWidth) / colWidth)); var date = cellToDate(0, col); var rowMatch = this.parentNode.className.match(/fc-slot(\d+)/); // TODO: maybe use data if (rowMatch) { var mins = parseInt(rowMatch[1]) * opt('slotMinutes'); var hours = Math.floor(mins/60); date.setHours(hours); date.setMinutes(mins%60 + minMinute); trigger('dayClick', dayBodyCells[col], date, false, ev); }else{ trigger('dayClick', dayBodyCells[col], date, true, ev); } } } /* Semi-transparent Overlay Helpers -----------------------------------------------------*/ // TODO: should be consolidated with BasicView's methods function renderDayOverlay(overlayStart, overlayEnd, refreshCoordinateGrid) { // overlayEnd is exclusive if (refreshCoordinateGrid) { coordinateGrid.build(); } var segments = rangeToSegments(overlayStart, overlayEnd); for (var i=0; i<segments.length; i++) { var segment = segments[i]; dayBind( renderCellOverlay( segment.row, segment.leftCol, segment.row, segment.rightCol ) ); } } function renderCellOverlay(row0, col0, row1, col1) { // only for all-day? var rect = coordinateGrid.rect(row0, col0, row1, col1, slotLayer); return renderOverlay(rect, slotLayer); } function renderSlotOverlay(overlayStart, overlayEnd) { for (var i=0; i<colCnt; i++) { var dayStart = cellToDate(0, i); var dayEnd = addDays(cloneDate(dayStart), 1); var stretchStart = new Date(Math.max(dayStart, overlayStart)); var stretchEnd = new Date(Math.min(dayEnd, overlayEnd)); if (stretchStart < stretchEnd) { var rect = coordinateGrid.rect(0, i, 0, i, slotContainer); // only use it for horizontal coords var top = timePosition(dayStart, stretchStart); var bottom = timePosition(dayStart, stretchEnd); rect.top = top; rect.height = bottom - top; slotBind( renderOverlay(rect, slotContainer) ); } } } /* Coordinate Utilities -----------------------------------------------------------------------------*/ coordinateGrid = new CoordinateGrid(function(rows, cols) { var e, n, p; dayHeadCells.each(function(i, _e) { e = $(_e); n = e.offset().left; if (i) { p[1] = n; } p = [n]; cols[i] = p; }); p[1] = n + e.outerWidth(); if (opt('allDaySlot')) { e = allDayRow; n = e.offset().top; rows[0] = [n, n+e.outerHeight()]; } var slotTableTop = slotContainer.offset().top; var slotScrollerTop = slotScroller.offset().top; var slotScrollerBottom = slotScrollerTop + slotScroller.outerHeight(); function constrain(n) { return Math.max(slotScrollerTop, Math.min(slotScrollerBottom, n)); } for (var i=0; i<slotCnt*snapRatio; i++) { // adapt slot count to increased/decreased selection slot count rows.push([ constrain(slotTableTop + snapHeight*i), constrain(slotTableTop + snapHeight*(i+1)) ]); } }); hoverListener = new HoverListener(coordinateGrid); colPositions = new HorizontalPositionCache(function(col) { return dayBodyCellInners.eq(col); }); colContentPositions = new HorizontalPositionCache(function(col) { return dayBodyCellContentInners.eq(col); }); function colLeft(col) { return colPositions.left(col); } function colContentLeft(col) { return colContentPositions.left(col); } function colRight(col) { return colPositions.right(col); } function colContentRight(col) { return colContentPositions.right(col); } function getIsCellAllDay(cell) { return opt('allDaySlot') && !cell.row; } function realCellToDate(cell) { // ugh "real" ... but blame it on our abuse of the "cell" system var d = cellToDate(0, cell.col); var slotIndex = cell.row; if (opt('allDaySlot')) { slotIndex--; } if (slotIndex >= 0) { addMinutes(d, minMinute + slotIndex * snapMinutes); } return d; } // get the Y coordinate of the given time on the given day (both Date objects) function timePosition(day, time) { // both date objects. day holds 00:00 of current day day = cloneDate(day, true); if (time < addMinutes(cloneDate(day), minMinute)) { return 0; } if (time >= addMinutes(cloneDate(day), maxMinute)) { return slotTable.height(); } var slotMinutes = opt('slotMinutes'), minutes = time.getHours()*60 + time.getMinutes() - minMinute, slotI = Math.floor(minutes / slotMinutes), slotTop = slotTopCache[slotI]; if (slotTop === undefined) { slotTop = slotTopCache[slotI] = slotTable.find('tr').eq(slotI).find('td div')[0].offsetTop; // .eq() is faster than ":eq()" selector // [0].offsetTop is faster than .position().top (do we really need this optimization?) // a better optimization would be to cache all these divs } return Math.max(0, Math.round( slotTop - 1 + slotHeight * ((minutes % slotMinutes) / slotMinutes) )); } function getAllDayRow(index) { return allDayRow; } function defaultEventEnd(event) { var start = cloneDate(event.start); if (event.allDay) { return start; } return addMinutes(start, opt('defaultEventMinutes')); } /* Selection ---------------------------------------------------------------------------------*/ function defaultSelectionEnd(startDate, allDay) { if (allDay) { return cloneDate(startDate); } return addMinutes(cloneDate(startDate), opt('slotMinutes')); } function renderSelection(startDate, endDate, allDay) { // only for all-day if (allDay) { if (opt('allDaySlot')) { renderDayOverlay(startDate, addDays(cloneDate(endDate), 1), true); } }else{ renderSlotSelection(startDate, endDate); } } function renderSlotSelection(startDate, endDate) { var helperOption = opt('selectHelper'); coordinateGrid.build(); if (helperOption) { var col = dateToCell(startDate).col; if (col >= 0 && col < colCnt) { // only works when times are on same day var rect = coordinateGrid.rect(0, col, 0, col, slotContainer); // only for horizontal coords var top = timePosition(startDate, startDate); var bottom = timePosition(startDate, endDate); if (bottom > top) { // protect against selections that are entirely before or after visible range rect.top = top; rect.height = bottom - top; rect.left += 2; rect.width -= 5; if ($.isFunction(helperOption)) { var helperRes = helperOption(startDate, endDate); if (helperRes) { rect.position = 'absolute'; selectionHelper = $(helperRes) .css(rect) .appendTo(slotContainer); } }else{ rect.isStart = true; // conside rect a "seg" now rect.isEnd = true; // selectionHelper = $(slotSegHtml( { title: '', start: startDate, end: endDate, className: ['fc-select-helper'], editable: false }, rect )); selectionHelper.css('opacity', opt('dragOpacity')); } if (selectionHelper) { slotBind(selectionHelper); slotContainer.append(selectionHelper); setOuterWidth(selectionHelper, rect.width, true); // needs to be after appended setOuterHeight(selectionHelper, rect.height, true); } } } }else{ renderSlotOverlay(startDate, endDate); } } function clearSelection() { clearOverlays(); if (selectionHelper) { selectionHelper.remove(); selectionHelper = null; } } function slotSelectionMousedown(ev) { if (ev.which == 1 && opt('selectable')) { // ev.which==1 means left mouse button unselect(ev); var dates; hoverListener.start(function(cell, origCell) { clearSelection(); if (cell && cell.col == origCell.col && !getIsCellAllDay(cell)) { var d1 = realCellToDate(origCell); var d2 = realCellToDate(cell); dates = [ d1, addMinutes(cloneDate(d1), snapMinutes), // calculate minutes depending on selection slot minutes d2, addMinutes(cloneDate(d2), snapMinutes) ].sort(dateCompare); renderSlotSelection(dates[0], dates[3]); }else{ dates = null; } }, ev); $(document).one('mouseup', function(ev) { hoverListener.stop(); if (dates) { if (+dates[0] == +dates[1]) { reportDayClick(dates[0], false, ev); } reportSelection(dates[0], dates[3], false, ev); } }); } } function reportDayClick(date, allDay, ev) { trigger('dayClick', dayBodyCells[dateToCell(date).col], date, allDay, ev); } /* External Dragging --------------------------------------------------------------------------------*/ function dragStart(_dragElement, ev, ui) { hoverListener.start(function(cell) { clearOverlays(); if (cell) { if (getIsCellAllDay(cell)) { renderCellOverlay(cell.row, cell.col, cell.row, cell.col); }else{ var d1 = realCellToDate(cell); var d2 = addMinutes(cloneDate(d1), opt('defaultEventMinutes')); renderSlotOverlay(d1, d2); } } }, ev); } function dragStop(_dragElement, ev, ui) { var cell = hoverListener.stop(); clearOverlays(); if (cell) { trigger('drop', _dragElement, realCellToDate(cell), getIsCellAllDay(cell), ev, ui); } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function determineWidthHandling(event) {\n\t// if(DEBUG) console.debug(\"WidthHandler called on \",event.target.tagName, \" with a width of \", event.target.width);\n\tvar tempMaxWidth = 800; // failsafe value\n\tif(episodePage) tempMaxWidth = 400;\n\tif(forumPage) tempMaxWidth = 790;\n\tif(event.target.width > te...
[ "0.6192343", "0.5903341", "0.5894427", "0.58507395", "0.58477694", "0.5834385", "0.58297944", "0.579227", "0.5780391", "0.5771063", "0.5737129", "0.57347333", "0.572361", "0.57130647", "0.5706589", "0.5702972", "0.5695426", "0.56880254", "0.566439", "0.5655668", "0.56504923",...
0.0
-1
TODO: datadate on the cells / Dimensions
function setHeight(height) { if (height === undefined) { height = viewHeight; } viewHeight = height; slotTopCache = {}; var headHeight = dayBody.position().top; var allDayHeight = slotScroller.position().top; // including divider var bodyHeight = Math.min( // total body height, including borders height - headHeight, // when scrollbars slotTable.height() + allDayHeight + 1 // when no scrollbars. +1 for bottom border ); dayBodyFirstCellStretcher .height(bodyHeight - vsides(dayBodyFirstCell)); slotLayer.css('top', headHeight); slotScroller.height(bodyHeight - allDayHeight - 1); // the stylesheet guarantees that the first row has no border. // this allows .height() to work well cross-browser. slotHeight = slotTable.find('tr:first').height() + 1; // +1 for bottom border snapRatio = opt('slotMinutes') / snapMinutes; snapHeight = slotHeight / snapRatio; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "data() {\n return this.cells().map((n) => n ? n.valueOf() : undefined );\n }", "function initCells(){\n\t\tvar days = ['Monday', 'Tuesday', 'Wednesday', \n\t\t\t'Thursday', 'Friday', 'Saturday', 'Sunday'];\n\t\tvar tableRows = document.getElementById('schedTable').children[0].children;\n\t\tvar numericClass ...
[ "0.5755072", "0.56416607", "0.56166995", "0.55649436", "0.55499125", "0.5527071", "0.5512077", "0.5506026", "0.5504503", "0.54746854", "0.5470471", "0.5451653", "0.54473984", "0.5442279", "0.5442279", "0.5442279", "0.5442279", "0.5442279", "0.5442181", "0.54334235", "0.540725...
0.0
-1
+1 for the border
function scroll() { slotScroller.scrollTop(top); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "drawBorder() {\n }", "function borderUp(x) {\r\n x.style.borderLeftStyle = 'solid';\r\n x.style.borderLeftWidth = '5px';\r\n x.style.borderLeftColor = '#B23A48';\r\n }", "function borderThicken(current,next) {\n\tcurrent.style.border = '1px solid gray';\n\tnext.style.border = '2px solid...
[ "0.7081219", "0.67396533", "0.67341596", "0.66817605", "0.6648171", "0.66328096", "0.6619604", "0.66070867", "0.65042734", "0.6339574", "0.63072073", "0.61948496", "0.6168479", "0.6079956", "0.6057421", "0.605224", "0.6040781", "0.59676975", "0.5918491", "0.5909045", "0.59053...
0.0
-1
Slot/Day clicking and binding
function dayBind(cells) { cells.click(slotClick) .mousedown(daySelectionMousedown); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function onSelectSlot(day) {\n setDayStartDate(day.start)\n setDayEndDate(day.end)\n setShowDayModal(true);\n console.log(\"day clicked: \", day.start)\n }", "function dayBind(days) {\n\t\tdays.click(dayClick).mousedown(daySelectionMousedown);\n\t}", "function dayClick(date, jsEv...
[ "0.71998256", "0.6506695", "0.64686227", "0.64469653", "0.6394954", "0.6394954", "0.6394954", "0.6394954", "0.6394954", "0.62329906", "0.6139942", "0.6121727", "0.60954607", "0.60795176", "0.60771334", "0.5928278", "0.59141916", "0.5814969", "0.5789158", "0.5777623", "0.57707...
0.6618068
4
Semitransparent Overlay Helpers TODO: should be consolidated with BasicView's methods
function renderDayOverlay(overlayStart, overlayEnd, refreshCoordinateGrid) { // overlayEnd is exclusive if (refreshCoordinateGrid) { coordinateGrid.build(); } var segments = rangeToSegments(overlayStart, overlayEnd); for (var i=0; i<segments.length; i++) { var segment = segments[i]; dayBind( renderCellOverlay( segment.row, segment.leftCol, segment.row, segment.rightCol ) ); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "showTransparentOverlay() {\n this.$transparentOverlay.show();\n }", "'transparent'(callback) {\n\t\tthis.style('opacity', 0, callback);\n\t}", "function overlay() {\n sketch.strokeWeight(1);\n sketch.stroke(0, 0, 255, 75);\n sketch.fill(0, 0, 255, 75);\n sketch.rectMode(sketch.C...
[ "0.6918043", "0.66223395", "0.6315963", "0.61009324", "0.595809", "0.594684", "0.5900771", "0.588486", "0.57595634", "0.57536864", "0.57295024", "0.5728503", "0.5715899", "0.5699432", "0.56782126", "0.56766874", "0.56609696", "0.56374496", "0.56336033", "0.5630101", "0.562753...
0.0
-1
get the Y coordinate of the given time on the given day (both Date objects)
function timePosition(day, time) { // both date objects. day holds 00:00 of current day day = cloneDate(day, true); if (time < addMinutes(cloneDate(day), minMinute)) { return 0; } if (time >= addMinutes(cloneDate(day), maxMinute)) { return slotTable.height(); } var slotMinutes = opt('slotMinutes'), minutes = time.getHours()*60 + time.getMinutes() - minMinute, slotI = Math.floor(minutes / slotMinutes), slotTop = slotTopCache[slotI]; if (slotTop === undefined) { slotTop = slotTopCache[slotI] = slotTable.find('tr').eq(slotI).find('td div')[0].offsetTop; // .eq() is faster than ":eq()" selector // [0].offsetTop is faster than .position().top (do we really need this optimization?) // a better optimization would be to cache all these divs } return Math.max(0, Math.round( slotTop - 1 + slotHeight * ((minutes % slotMinutes) / slotMinutes) )); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getTime(time, day) {\n time = Math.round((time + 0.1) * 100) / 100;\n\n if (time >= day) {\n return 0;\n }\n else {\n return time;\n }\n }", "function getDateCoordinate(date, urgent_axis) {\n var today = new Date();\n // Einteilung Tage pro Phase\n ONEMONTH = [1, 4, 7, 30];\...
[ "0.60949945", "0.5881482", "0.58699", "0.5665571", "0.544988", "0.5331264", "0.531377", "0.5295034", "0.5275747", "0.5255831", "0.5245741", "0.52311003", "0.5224225", "0.5205936", "0.52017856", "0.5170296", "0.5162226", "0.51547134", "0.514201", "0.514201", "0.514201", "0.5...
0.57504684
4
renders events in the 'time slots' at the bottom TODO: when we refactor this, when user returns `false` eventRender, don't have empty space TODO: refactor will include using pixels to detect collisions instead of dates (handy for seg cmp)
function renderSlotSegs(segs, modifiedEventId) { var i, segCnt=segs.length, seg, event, top, bottom, columnLeft, columnRight, columnWidth, width, left, right, html = '', eventElements, eventElement, triggerRes, titleElement, height, slotSegmentContainer = getSlotSegmentContainer(), isRTL = opt('isRTL'); // calculate position/dimensions, create html for (i=0; i<segCnt; i++) { seg = segs[i]; event = seg.event; top = timePosition(seg.start, seg.start); bottom = timePosition(seg.start, seg.end); columnLeft = colContentLeft(seg.col); columnRight = colContentRight(seg.col); columnWidth = columnRight - columnLeft; // shave off space on right near scrollbars (2.5%) // TODO: move this to CSS somehow columnRight -= columnWidth * .025; columnWidth = columnRight - columnLeft; width = columnWidth * (seg.forwardCoord - seg.backwardCoord); if (opt('slotEventOverlap')) { // double the width while making sure resize handle is visible // (assumed to be 20px wide) width = Math.max( (width - (20/2)) * 2, width // narrow columns will want to make the segment smaller than // the natural width. don't allow it ); } if (isRTL) { right = columnRight - seg.backwardCoord * columnWidth; left = right - width; } else { left = columnLeft + seg.backwardCoord * columnWidth; right = left + width; } // make sure horizontal coordinates are in bounds left = Math.max(left, columnLeft); right = Math.min(right, columnRight); width = right - left; seg.top = top; seg.left = left; seg.outerWidth = width; seg.outerHeight = bottom - top; html += slotSegHtml(event, seg); } slotSegmentContainer[0].innerHTML = html; // faster than html() eventElements = slotSegmentContainer.children(); // retrieve elements, run through eventRender callback, bind event handlers for (i=0; i<segCnt; i++) { seg = segs[i]; event = seg.event; eventElement = $(eventElements[i]); // faster than eq() triggerRes = trigger('eventRender', event, event, eventElement); if (triggerRes === false) { eventElement.remove(); }else{ if (triggerRes && triggerRes !== true) { eventElement.remove(); eventElement = $(triggerRes) .css({ position: 'absolute', top: seg.top, left: seg.left }) .appendTo(slotSegmentContainer); } seg.element = eventElement; if (event._id === modifiedEventId) { bindSlotSeg(event, eventElement, seg); }else{ eventElement[0]._fci = i; // for lazySegBind } reportEventElement(event, eventElement); } } lazySegBind(slotSegmentContainer, segs, bindSlotSeg); // record event sides and title positions for (i=0; i<segCnt; i++) { seg = segs[i]; if (eventElement = seg.element) { seg.vsides = vsides(eventElement, true); seg.hsides = hsides(eventElement, true); titleElement = eventElement.find('.fc-event-title'); if (titleElement.length) { seg.contentTop = titleElement[0].offsetTop; } } } // set all positions/dimensions at once for (i=0; i<segCnt; i++) { seg = segs[i]; if (eventElement = seg.element) { eventElement[0].style.width = Math.max(0, seg.outerWidth - seg.hsides) + 'px'; height = Math.max(0, seg.outerHeight - seg.vsides); eventElement[0].style.height = height + 'px'; event = seg.event; if (seg.contentTop !== undefined && height - seg.contentTop < 10) { // not enough room for title, put it in the time (TODO: maybe make both display:inline instead) eventElement.find('div.fc-event-time') .text(formatDate(event.start, opt('timeFormat')) + ' - ' + event.title); eventElement.find('div.fc-event-title') .remove(); } trigger('eventAfterRender', event, event, eventElement); } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function renderEvents() {\n var totalPercent = 100,\n currentEvent,\n curCol,\n width,\n height,\n leftOffset,\n eventText,\n i,\n j;\n \n // empty container before adding new events\n $el.empty();\n \n // go through all columns\n for (i=...
[ "0.74002343", "0.67643917", "0.66800594", "0.6649606", "0.6502214", "0.6493799", "0.64850897", "0.6452194", "0.64472616", "0.64430594", "0.64420396", "0.64119506", "0.63961464", "0.6375376", "0.63709795", "0.63495475", "0.63366467", "0.63275576", "0.6282625", "0.6250975", "0....
0.6236654
22
Dragging when event starts out FULLDAY overrides DayEventRenderer's version because it needs to account for dragging elements to and from the slot area.
function draggableDayEvent(event, eventElement, seg) { var isStart = seg.isStart; var origWidth; var revert; var allDay = true; var dayDelta; var hoverListener = getHoverListener(); var colWidth = getColWidth(); var snapHeight = getSnapHeight(); var snapMinutes = getSnapMinutes(); var minMinute = getMinMinute(); eventElement.draggable({ opacity: opt('dragOpacity', 'month'), // use whatever the month view was using revertDuration: opt('dragRevertDuration'), start: function(ev, ui) { trigger('eventDragStart', eventElement, event, ev, ui); hideEvents(event, eventElement); origWidth = eventElement.width(); hoverListener.start(function(cell, origCell) { clearOverlays(); if (cell) { revert = false; var origDate = cellToDate(0, origCell.col); var date = cellToDate(0, cell.col); dayDelta = dayDiff(date, origDate); if (!cell.row) { // on full-days renderDayOverlay( addDays(cloneDate(event.start), dayDelta), addDays(exclEndDay(event), dayDelta) ); resetElement(); }else{ // mouse is over bottom slots if (isStart) { if (allDay) { // convert event to temporary slot-event eventElement.width(colWidth - 10); // don't use entire width setOuterHeight( eventElement, snapHeight * Math.round( (event.end ? ((event.end - event.start) / MINUTE_MS) : opt('defaultEventMinutes')) / snapMinutes ) ); eventElement.draggable('option', 'grid', [colWidth, 1]); allDay = false; } }else{ revert = true; } } revert = revert || (allDay && !dayDelta); }else{ resetElement(); revert = true; } eventElement.draggable('option', 'revert', revert); }, ev, 'drag'); }, stop: function(ev, ui) { hoverListener.stop(); clearOverlays(); trigger('eventDragStop', eventElement, event, ev, ui); if (revert) { // hasn't moved or is out of bounds (draggable has already reverted) resetElement(); eventElement.css('filter', ''); // clear IE opacity side-effects showEvents(event, eventElement); }else{ // changed! var minuteDelta = 0; if (!allDay) { minuteDelta = Math.round((eventElement.offset().top - getSlotContainer().offset().top) / snapHeight) * snapMinutes + minMinute - (event.start.getHours() * 60 + event.start.getMinutes()); } eventDrop(this, event, dayDelta, minuteDelta, allDay, ev, ui); } } }); function resetElement() { if (!allDay) { eventElement .width(origWidth) .height('') .draggable('option', 'grid', null); allDay = true; } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function draggableDayEvent(event, eventElement, seg) {\n\t\tvar isStart = seg.isStart;\n\t\tvar origWidth;\n\t\tvar revert;\n\t\tvar allDay = true;\n\t\tvar dayDelta;\n\n\t\tvar hoverListener = getHoverListener();\n\t\tvar colWidth = getColWidth();\n\t\tvar minTime = getMinTime();\n\t\tvar slotDuration = getSlotDu...
[ "0.7330154", "0.73251206", "0.7316514", "0.6536271", "0.64647335", "0.6203449", "0.6203449", "0.6203449", "0.6156504", "0.61459124", "0.6135377", "0.5807905", "0.57835174", "0.574367", "0.57217723", "0.57146806", "0.5701051", "0.5700214", "0.56108963", "0.56026596", "0.558511...
0.7400583
1
when event starts out IN TIMESLOTS
function draggableSlotEvent(event, eventElement, timeElement) { var coordinateGrid = t.getCoordinateGrid(); var colCnt = getColCnt(); var colWidth = getColWidth(); var snapHeight = getSnapHeight(); var snapMinutes = getSnapMinutes(); // states var origPosition; // original position of the element, not the mouse var origCell; var isInBounds, prevIsInBounds; var isAllDay, prevIsAllDay; var colDelta, prevColDelta; var dayDelta; // derived from colDelta var minuteDelta, prevMinuteDelta; eventElement.draggable({ scroll: false, grid: [ colWidth, snapHeight ], axis: colCnt==1 ? 'y' : false, opacity: opt('dragOpacity'), revertDuration: opt('dragRevertDuration'), start: function(ev, ui) { trigger('eventDragStart', eventElement, event, ev, ui); hideEvents(event, eventElement); coordinateGrid.build(); // initialize states origPosition = eventElement.position(); origCell = coordinateGrid.cell(ev.pageX, ev.pageY); isInBounds = prevIsInBounds = true; isAllDay = prevIsAllDay = getIsCellAllDay(origCell); colDelta = prevColDelta = 0; dayDelta = 0; minuteDelta = prevMinuteDelta = 0; }, drag: function(ev, ui) { // NOTE: this `cell` value is only useful for determining in-bounds and all-day. // Bad for anything else due to the discrepancy between the mouse position and the // element position while snapping. (problem revealed in PR #55) // // PS- the problem exists for draggableDayEvent() when dragging an all-day event to a slot event. // We should overhaul the dragging system and stop relying on jQuery UI. var cell = coordinateGrid.cell(ev.pageX, ev.pageY); // update states isInBounds = !!cell; if (isInBounds) { isAllDay = getIsCellAllDay(cell); // calculate column delta colDelta = Math.round((ui.position.left - origPosition.left) / colWidth); if (colDelta != prevColDelta) { // calculate the day delta based off of the original clicked column and the column delta var origDate = cellToDate(0, origCell.col); var col = origCell.col + colDelta; col = Math.max(0, col); col = Math.min(colCnt-1, col); var date = cellToDate(0, col); dayDelta = dayDiff(date, origDate); } // calculate minute delta (only if over slots) if (!isAllDay) { minuteDelta = Math.round((ui.position.top - origPosition.top) / snapHeight) * snapMinutes; } } // any state changes? if ( isInBounds != prevIsInBounds || isAllDay != prevIsAllDay || colDelta != prevColDelta || minuteDelta != prevMinuteDelta ) { updateUI(); // update previous states for next time prevIsInBounds = isInBounds; prevIsAllDay = isAllDay; prevColDelta = colDelta; prevMinuteDelta = minuteDelta; } // if out-of-bounds, revert when done, and vice versa. eventElement.draggable('option', 'revert', !isInBounds); }, stop: function(ev, ui) { clearOverlays(); trigger('eventDragStop', eventElement, event, ev, ui); if (isInBounds && (isAllDay || dayDelta || minuteDelta)) { // changed! eventDrop(this, event, dayDelta, isAllDay ? 0 : minuteDelta, isAllDay, ev, ui); } else { // either no change or out-of-bounds (draggable has already reverted) // reset states for next time, and for updateUI() isInBounds = true; isAllDay = false; colDelta = 0; dayDelta = 0; minuteDelta = 0; updateUI(); eventElement.css('filter', ''); // clear IE opacity side-effects // sometimes fast drags make event revert to wrong position, so reset. // also, if we dragged the element out of the area because of snapping, // but the *mouse* is still in bounds, we need to reset the position. eventElement.css(origPosition); showEvents(event, eventElement); } } }); function updateUI() { clearOverlays(); if (isInBounds) { if (isAllDay) { timeElement.hide(); eventElement.draggable('option', 'grid', null); // disable grid snapping renderDayOverlay( addDays(cloneDate(event.start), dayDelta), addDays(exclEndDay(event), dayDelta) ); } else { updateTimeText(minuteDelta); timeElement.css('display', ''); // show() was causing display=inline eventElement.draggable('option', 'grid', [colWidth, snapHeight]); // re-enable grid snapping } } } function updateTimeText(minuteDelta) { var newStart = addMinutes(cloneDate(event.start), minuteDelta); var newEnd; if (event.end) { newEnd = addMinutes(cloneDate(event.end), minuteDelta); } timeElement.text(formatDates(newStart, newEnd, opt('timeFormat'))); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function onEventTimer() {\n triggerEvents(inbandEvents);\n triggerEvents(inlineEvents);\n removeEvents();\n }", "ontimeout() {}", "function endEvent(){}", "function battleStartEventAdding() {\n if (store.getState().lastAction == 'BATTLE_ON') {\n setTimeout(function(){\n ...
[ "0.6506741", "0.63518757", "0.6318171", "0.6276839", "0.6240819", "0.61770076", "0.61105776", "0.6026963", "0.60206383", "0.6010281", "0.5982377", "0.5963287", "0.5865532", "0.5839777", "0.58148485", "0.57903093", "0.5786494", "0.5762277", "0.57587284", "0.57505137", "0.57270...
0.0
-1
Agenda Event Segment Utilities Sets the seg.backwardCoord and seg.forwardCoord on each segment and returns a new list in the order they should be placed into the DOM (an implicit zindex).
function placeSlotSegs(segs) { var levels = buildSlotSegLevels(segs); var level0 = levels[0]; var i; computeForwardSlotSegs(levels); if (level0) { for (i=0; i<level0.length; i++) { computeSlotSegPressures(level0[i]); } for (i=0; i<level0.length; i++) { computeSlotSegCoords(level0[i], 0, 0); } } return flattenSlotSegLevels(levels); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "get excludeCollinear(){\n\t\tlet list = this.segList2D;\n\t\tlet newlist = [];\n\t\tfor (let i=0; i<list.length; i++){\n\t\t\tlet thisseg = list[i];\n\t\t\tlet x0 = thisseg.a[0];\n\t\t\tlet y0 = thisseg.a[1];\n\t\t\tlet x1 = thisseg.b[0];\n\t\t\tlet y1 = thisseg.b[1];\n\t\t\tlet nextseg\n\t\t\tif (i === list.lengt...
[ "0.5672598", "0.5660908", "0.5660908", "0.55643374", "0.55643374", "0.55643374", "0.5452507", "0.5443274", "0.5443274", "0.5443274", "0.5443274", "0.5443274", "0.5393528", "0.53895", "0.5380696", "0.5335", "0.52500874", "0.5224285", "0.5220486", "0.5220486", "0.5220486", "0...
0.0
-1
Builds an array of segments "levels". The first level will be the leftmost tier of segments if the calendar is lefttoright, or the rightmost if the calendar is righttoleft.
function buildSlotSegLevels(segs) { var levels = []; var i, seg; var j; for (i=0; i<segs.length; i++) { seg = segs[i]; // go through all the levels and stop on the first level where there are no collisions for (j=0; j<levels.length; j++) { if (!computeSlotSegCollisions(seg, levels[j]).length) { break; } } (levels[j] || (levels[j] = [])).push(seg); } return levels; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function buildSlotSegLevels(segs) {\n var levels = [];\n var i;\n var seg;\n var j;\n\n for (i = 0; i < segs.length; i++) {\n seg = segs[i]; // go through all the levels and stop on the first level where there are no collisions\n\n for (j = 0; j < levels.length;...
[ "0.6903039", "0.6840614", "0.6754012", "0.67478883", "0.6744979", "0.6744979", "0.6744979", "0.6727008", "0.67002255", "0.67002255", "0.67002255", "0.67002255", "0.67002255", "0.6696867", "0.6696867", "0.6696867", "0.6696867", "0.6696867", "0.6696867", "0.6696867", "0.6696867...
0.66935784
24
For every segment, figure out the other segments that are in subsequent levels that also occupy the same vertical space. Accumulate in seg.forwardSegs
function computeForwardSlotSegs(levels) { var i, level; var j, seg; var k; for (i=0; i<levels.length; i++) { level = levels[i]; for (j=0; j<level.length; j++) { seg = level[j]; seg.forwardSegs = []; for (k=i+1; k<levels.length; k++) { computeSlotSegCollisions(seg, levels[k], seg.forwardSegs); } } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function computeSlotSegPressures(seg){var forwardSegs=seg.forwardSegs;var forwardPressure=0;var i;var forwardSeg;if(seg.forwardPressure===undefined){// not already computed\nfor(i=0;i<forwardSegs.length;i++){forwardSeg=forwardSegs[i];// figure out the child's maximum forward path\ncomputeSlotSegPressures(forwardSe...
[ "0.71585286", "0.6983252", "0.6753893", "0.6746319", "0.6746319", "0.6746319", "0.67435366", "0.6742942", "0.6721177", "0.6715314", "0.6715314", "0.6715314", "0.6715314", "0.6715314", "0.6680565", "0.666221", "0.65074813", "0.64183474", "0.63594645", "0.6335663", "0.62791157"...
0.66124886
27
Figure out which path forward (via seg.forwardSegs) results in the longest path until the furthest edge is reached. The number of segments in this path will be seg.forwardPressure
function computeSlotSegPressures(seg) { var forwardSegs = seg.forwardSegs; var forwardPressure = 0; var i, forwardSeg; if (seg.forwardPressure === undefined) { // not already computed for (i=0; i<forwardSegs.length; i++) { forwardSeg = forwardSegs[i]; // figure out the child's maximum forward path computeSlotSegPressures(forwardSeg); // either use the existing maximum, or use the child's forward pressure // plus one (for the forwardSeg itself) forwardPressure = Math.max( forwardPressure, 1 + forwardSeg.forwardPressure ); } seg.forwardPressure = forwardPressure; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function computeForwardSlotSegs(levels){var i;var level;var j;var seg;var k;for(i=0;i<levels.length;i++){level=levels[i];for(j=0;j<level.length;j++){seg=level[j];seg.forwardSegs=[];for(k=i+1;k<levels.length;k++){computeSlotSegCollisions(seg,levels[k],seg.forwardSegs);}}}}// Figure out which path forward (via seg.f...
[ "0.6253654", "0.604457", "0.6042051", "0.59691864", "0.59618175", "0.59177715", "0.59177715", "0.59177715", "0.5915732", "0.5915732", "0.59009796", "0.58541346", "0.58541346", "0.58541346", "0.58241874", "0.57947606", "0.5730811", "0.572307", "0.5517095", "0.5477632", "0.5372...
0.5820561
26
Calculate seg.forwardCoord and seg.backwardCoord for the segment, where both values range from 0 to 1. If the calendar is lefttoright, the seg.backwardCoord maps to "left" and seg.forwardCoord maps to "right" (via percentage). Viceversa if the calendar is righttoleft. The segment might be part of a "series", which means consecutive segments with the same pressure who's width is unknown until an edge has been hit. `seriesBackwardPressure` is the number of segments behind this one in the current series, and `seriesBackwardCoord` is the starting coordinate of the first segment in the series.
function computeSlotSegCoords(seg, seriesBackwardPressure, seriesBackwardCoord) { var forwardSegs = seg.forwardSegs; var i; if (seg.forwardCoord === undefined) { // not already computed if (!forwardSegs.length) { // if there are no forward segments, this segment should butt up against the edge seg.forwardCoord = 1; } else { // sort highest pressure first forwardSegs.sort(compareForwardSlotSegs); // this segment's forwardCoord will be calculated from the backwardCoord of the // highest-pressure forward segment. computeSlotSegCoords(forwardSegs[0], seriesBackwardPressure + 1, seriesBackwardCoord); seg.forwardCoord = forwardSegs[0].backwardCoord; } // calculate the backwardCoord from the forwardCoord. consider the series seg.backwardCoord = seg.forwardCoord - (seg.forwardCoord - seriesBackwardCoord) / // available width for series (seriesBackwardPressure + 1); // # of segments in the series // use this segment's coordinates to computed the coordinates of the less-pressurized // forward segments for (i=0; i<forwardSegs.length; i++) { computeSlotSegCoords(forwardSegs[i], 0, seg.forwardCoord); } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function computeSlotSegCoords(seg, seriesBackwardPressure, seriesBackwardCoord) {\n var forwardSegs = seg.forwardSegs;\n var i;\n\n if (seg.forwardCoord === undefined) { // not already computed\n\n if (!forwardSegs.length) {\n\n // if there are no forward segments, th...
[ "0.7214821", "0.6890389", "0.68086404", "0.53262943", "0.50056565", "0.49334535", "0.48296118", "0.4654403", "0.46424586", "0.4640138", "0.45991546", "0.45476672", "0.45442688", "0.45073557", "0.44972754", "0.4471565", "0.4471565", "0.44544843", "0.44544843", "0.44544843", "0...
0.7149088
5
Outputs a flat array of segments, from lowest to highest level
function flattenSlotSegLevels(levels) { var segs = []; var i, level; var j; for (i=0; i<levels.length; i++) { level = levels[i]; for (j=0; j<level.length; j++) { segs.push(level[j]); } } return segs; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function n(a){var b,c,d,e=M(),f=[];\n// group segments by row\nfor(b=0;b<a.length;b++)c=a[b],d=c.row,c.element&&(// was rendered?\nf[d]?\n// already other segments. append to array\nf[d].push(c):\n// first segment in row. create new array\nf[d]=[c]);\n// sort each row\nfor(d=0;d<e;d++)f[d]=o(f[d]||[]);return f}", ...
[ "0.6585937", "0.6369735", "0.6369735", "0.6369735", "0.6369735", "0.6369735", "0.60024637", "0.59718955", "0.5913242", "0.5913242", "0.5913242", "0.5913242", "0.5913242", "0.57812893", "0.5768273", "0.5768273", "0.5768273", "0.5768273", "0.5768273", "0.57666355", "0.5750429",...
0.5948577
11
Find all the segments in `otherSegs` that vertically collide with `seg`. Append into an optionallysupplied `results` array and return.
function computeSlotSegCollisions(seg, otherSegs, results) { results = results || []; for (var i=0; i<otherSegs.length; i++) { if (isSlotSegCollision(seg, otherSegs[i])) { results.push(otherSegs[i]); } } return results; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function computeSlotSegCollisions(seg, otherSegs, results) {\n if (results === void 0) {\n results = [];\n }\n\n for (var i = 0; i < otherSegs.length; i++) {\n if (isSlotSegCollision(seg, otherSegs[i])) {\n results.push(otherSegs[i]);\n }\n }\n\n ...
[ "0.7555488", "0.7555209", "0.7392598", "0.7213493", "0.71773744", "0.71773744", "0.71773744", "0.71619445", "0.71619445", "0.71619445", "0.71619445", "0.71619445", "0.7153957", "0.70636165", "0.5999384", "0.5942109", "0.5452845", "0.5361053", "0.52301383", "0.52275014", "0.51...
0.7109062
24
Do these segments occupy the same vertical space?
function isSlotSegCollision(seg1, seg2) { return seg1.end > seg2.start && seg1.start < seg2.end; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "resolveSegmentSegment(ax1, ay1, ax2, ay2, bx1, by1, bx2, by2) {\n const result = [];\n const isHorizontal1 = ax2 - ax1 > ay2 - ay1;\n const isHorizontal2 = bx2 - bx1 > by2 - by1;\n\n if (isHorizontal1 && isHorizontal2 &&\n by1 === ay1 &&\n ((ax1 <= bx2 && ax1 >= bx...
[ "0.64230865", "0.6271409", "0.61475646", "0.6019541", "0.5960251", "0.5878266", "0.58621514", "0.58603257", "0.5844158", "0.58419555", "0.58341056", "0.583265", "0.5799967", "0.57981145", "0.5783428", "0.57212204", "0.57212204", "0.5703831", "0.5703831", "0.5703831", "0.56836...
0.0
-1
A cmp function for determining which forward segment to rely on more when computing coordinates.
function compareForwardSlotSegs(seg1, seg2) { // put higher-pressure first return seg2.forwardPressure - seg1.forwardPressure || // put segments that are closer to initial edge first (and favor ones with no coords yet) (seg1.backwardCoord || 0) - (seg2.backwardCoord || 0) || // do normal sorting... compareSlotSegs(seg1, seg2); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function compareForwardSlotSegs(seg1, seg2) {\n // put higher-pressure first\n return seg2.forwardPressure - seg1.forwardPressure ||\n // put segments that are closer to initial edge first (and favor ones with no coords yet)\n (seg1.backwardCoord || 0) - (seg2.backwardCoord || 0...
[ "0.6616612", "0.6586231", "0.6456864", "0.6456864", "0.6099895", "0.60849357", "0.60275626", "0.59970236", "0.59020436", "0.5789727", "0.5754013", "0.57451004", "0.5742221", "0.5742061", "0.5736823", "0.56873155", "0.56873155", "0.56790227", "0.5658989", "0.5641172", "0.55903...
0.66068625
5
A cmp function for determining which segment should be closer to the initial edge (the left edge on a lefttoright calendar).
function compareSlotSegs(seg1, seg2) { return seg1.start - seg2.start || // earlier start time goes first (seg2.end - seg2.start) - (seg1.end - seg1.start) || // tie? longer-duration goes first (seg1.event.title || '').localeCompare(seg2.event.title); // tie? alphabetically by title }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function compareDaySegments(a, b) {\n\treturn (b.rightCol - b.leftCol) - (a.rightCol - a.leftCol) || // put wider events first\n\t\tb.event.allDay - a.event.allDay || // if tie, put all-day events first (booleans cast to 0/1)\n\t\ta.event.start - b.event.start || // if a tie, sort by event start date\n\t\t(a.event...
[ "0.6483038", "0.6483038", "0.6483038", "0.64785343", "0.6472763", "0.64679307", "0.64679307", "0.6424718", "0.6424718", "0.6424718", "0.6424718", "0.6424718", "0.6266211", "0.61569923", "0.61569923", "0.61569923", "0.61569923", "0.61569923", "0.61342937", "0.61342937", "0.608...
0.57023054
60
Event Editable Boolean Calculations
function isEventDraggable(event) { var source = event.source || {}; return firstDefined( event.startEditable, source.startEditable, opt('eventStartEditable'), event.editable, source.editable, opt('editable') ) && !opt('disableDragging'); // deprecated }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "shouldUpdate(e){return!0}", "function fContext(event) {\n if (!event)\n event = getEvent(event);\n var obj = event.srcElement || event.target;\n if (obj.type == \"text\" || obj.type == \"textarea\") {\n obj.IsCheckedOnKd = true;\n return true;\n }\n else\n return false;...
[ "0.6374638", "0.5901404", "0.58894676", "0.58013666", "0.5777864", "0.56935936", "0.5665825", "0.55845636", "0.55741537", "0.5552515", "0.5543067", "0.5534451", "0.5532684", "0.5532342", "0.55193037", "0.55173045", "0.5504705", "0.5491351", "0.5475459", "0.5450076", "0.544973...
0.0
-1
returns a Date object for an event's end
function eventEnd(event) { return event.end ? cloneDate(event.end) : defaultEventEnd(event); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "get endTime() {\n let result = null;\n if (this.ended) {\n result = new Date(this.startTime.getTime() + this.duration);\n }\n return result;\n }", "getEndOfDay() {\n const endOfDay = new UniversalDate(this.date);\n endOfDay.date.setUTCHours(23);\n endOfDay.date....
[ "0.6732769", "0.6603668", "0.6551043", "0.6455461", "0.6441716", "0.6258558", "0.6200399", "0.60559", "0.6046308", "0.6005255", "0.6005255", "0.5983581", "0.5857088", "0.5827639", "0.58114266", "0.57952404", "0.57930386", "0.57554406", "0.57544976", "0.57317954", "0.5662578",...
0.80911815
2
Event Elements report when view creates an element for an event
function reportEventElement(event, element) { eventElementCouples.push({ event: event, element: element }); if (eventElementsByID[event._id]) { eventElementsByID[event._id].push(element); }else{ eventElementsByID[event._id] = [element]; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function _onElementAdded() {\n \n\t\t\t countElements++;\n \n\t\t\t //add all elements of a view\n\t\t\t if(countElements < elements.length) {\n\t\t\t\t var element = elements[countElements];\n\t\t\t\t if(!_removeNotValidElementObj(element)) {\n\t\t\t\t\t instance.addElement( element.type, element.source, ...
[ "0.6776248", "0.67019135", "0.6370747", "0.61872584", "0.6179898", "0.6179898", "0.6179898", "0.61724275", "0.6079138", "0.6066581", "0.6004647", "0.5962614", "0.5921373", "0.5896607", "0.58586746", "0.58586746", "0.58519924", "0.58393735", "0.5802533", "0.57836944", "0.57694...
0.61355317
11
attaches eventClick, eventMouseover, eventMouseout
function eventElementHandlers(event, eventElement) { eventElement .click(function(ev) { if (!eventElement.hasClass('ui-draggable-dragging') && !eventElement.hasClass('ui-resizable-resizing')) { return trigger('eventClick', this, event, ev); } }) .hover( function(ev) { trigger('eventMouseover', this, event, ev); }, function(ev) { trigger('eventMouseout', this, event, ev); } ); // TODO: don't fire eventMouseover/eventMouseout *while* dragging is occuring (on subject element) // TODO: same for resizing }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function addE(n){\n n.addEventListener(\"mouseover\", over);\n n.addEventListener(\"mouseout\", out);\n n.addEventListener(\"click\", click);\n}", "function addEventListeners() {\r document.getElementById(\"clickTag\").addEventListener(\"click\", clickthrough);\r\tdocument.getElementById(\"clickTag\").addE...
[ "0.7069479", "0.68961555", "0.6745706", "0.66307616", "0.6529238", "0.6525288", "0.64054245", "0.6380369", "0.635128", "0.62944245", "0.62944245", "0.629285", "0.62600887", "0.62205654", "0.61982363", "0.61863494", "0.6186197", "0.61146176", "0.61044514", "0.61044514", "0.610...
0.0
-1
Is the current day hidden? `day` is a dayofweek index (06), or a Date object
function isHiddenDay(day) { if (typeof day == 'object') { day = day.getDay(); } return isHiddenDayHash[day]; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function isHiddenDay(day) {\n\t\tif (moment.isMoment(day)) {\n\t\t\tday = day.day();\n\t\t}\n\t\treturn isHiddenDayHash[day];\n\t}", "function isHiddenDay(day) {\n\t\tif (moment.isMoment(day)) {\n\t\t\tday = day.day();\n\t\t}\n\t\treturn isHiddenDayHash[day];\n\t}", "isDay() {\n\t\treturn (Date.now() + 60000 *...
[ "0.7997653", "0.7997653", "0.65342593", "0.6412175", "0.6257553", "0.6251053", "0.62408674", "0.61389416", "0.6102063", "0.6083765", "0.6053988", "0.6049042", "0.60418355", "0.6027048", "0.5966861", "0.59495306", "0.5943973", "0.5942538", "0.5923337", "0.5917297", "0.59078807...
0.8230715
2
Keep incrementing the current day until it is no longer a hidden day. If the initial value of `date` is not a hidden day, don't do anything. Pass `isExclusive` as `true` if you are dealing with an end date. `inc` defaults to `1` (increment one day forward each time)
function skipHiddenDays(date, inc, isExclusive) { inc = inc || 1; while ( isHiddenDayHash[ ( date.getDay() + (isExclusive ? inc : 0) + 7 ) % 7 ] ) { addDays(date, inc); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function skipHiddenDays(date, inc, isExclusive) {\n\t\tvar out = date.clone();\n\t\tinc = inc || 1;\n\t\twhile (\n\t\t\tisHiddenDayHash[(out.day() + (isExclusive ? inc : 0) + 7) % 7]\n\t\t) {\n\t\t\tout.add('days', inc);\n\t\t}\n\t\treturn out;\n\t}", "function skipHiddenDays(date, inc, isExclusive) {\n\t\tvar o...
[ "0.73913074", "0.73913074", "0.6124914", "0.6121094", "0.59340143", "0.58831596", "0.55581415", "0.5458276", "0.5367962", "0.53553057", "0.53483295", "0.5285889", "0.51918095", "0.5187234", "0.5161901", "0.508674", "0.5062967", "0.5055871", "0.5031762", "0.49960992", "0.49897...
0.7420353
2
cell offset > day offset
function cellOffsetToDayOffset(cellOffset) { var day0 = t.visStart.getDay(); // first date's day of week cellOffset += dayToCellMap[day0]; // normlize cellOffset to beginning-of-week return Math.floor(cellOffset / cellsPerWeek) * 7 // # of days from full weeks + cellToDayMap[ // # of days from partial last week (cellOffset % cellsPerWeek + cellsPerWeek) % cellsPerWeek // crazy math to handle negative cellOffsets ] - day0; // adjustment for beginning-of-week normalization }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function dayOffsetToCellOffset(dayOffset) {\n\t\tvar day0 = t.visStart.getDay(); // first date's day of week\n\t\tdayOffset += day0; // normalize dayOffset to beginning-of-week\n\t\treturn Math.floor(dayOffset / 7) * cellsPerWeek // # of cells from full weeks\n\t\t\t+ dayToCellMap[ // # of cells from partial last ...
[ "0.7143289", "0.7143289", "0.7143289", "0.7051977", "0.7051977", "0.6806683", "0.6806683", "0.59999496", "0.59220856", "0.57997286", "0.57997286", "0.57997286", "0.57997286", "0.57997286", "0.57478356", "0.572953", "0.5674477", "0.565805", "0.5571544", "0.5571544", "0.5571544...
0.6941668
6
day offset > date (JavaScript Date object)
function dayOffsetToDate(dayOffset) { var date = cloneDate(t.visStart); addDays(date, dayOffset); return date; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function dateToDayOffset(date) {\n\t\treturn date.clone().stripTime().diff(t.start, 'days');\n\t}", "function dateToDayOffset(date) {\n\t\treturn date.clone().stripTime().diff(t.start, 'days');\n\t}", "function dateToDayOffset(date) {\n\t\treturn dayDiff(date, t.visStart);\n\t}", "function dateToDayOffset(da...
[ "0.75193644", "0.75193644", "0.717648", "0.717648", "0.717648", "0.71749514", "0.7152707", "0.65581214", "0.65581214", "0.6480398", "0.62511355", "0.6242571", "0.6144856", "0.6016284", "0.5947486", "0.59390366", "0.5920385", "0.58628374", "0.58557093", "0.5851208", "0.5831339...
0.6605572
9
TRANSFORMATIONS: date > day offset > cell offset > cell date > cell (combines all transformations)
function dateToCell(date) { var dayOffset = dateToDayOffset(date); var cellOffset = dayOffsetToCellOffset(dayOffset); var cell = cellOffsetToCell(cellOffset); return cell; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function dayOffsetToCellOffset(dayOffset) {\n\t\tvar day0 = t.start.day(); // first date's day of week\n\t\tdayOffset += day0; // normalize dayOffset to beginning-of-week\n\t\treturn Math.floor(dayOffset / 7) * cellsPerWeek + // # of cells from full weeks\n\t\t\tdayToCellMap[ // # of cells from partial last week\n...
[ "0.5514036", "0.5514036", "0.54815423", "0.54815423", "0.5451628", "0.5447734", "0.5447734", "0.5447734", "0.5423592", "0.5423592", "0.5423592", "0.52930284", "0.52907693", "0.5036622", "0.50285876", "0.50115466", "0.49861038", "0.48386914", "0.47938576", "0.4792582", "0.4766...
0.5552037
4
date > day offset
function dateToDayOffset(date) { return dayDiff(date, t.visStart); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function dateToDayOffset(date) {\n\t\treturn date.clone().stripTime().diff(t.start, 'days');\n\t}", "function dateToDayOffset(date) {\n\t\treturn date.clone().stripTime().diff(t.start, 'days');\n\t}", "getDateOffset(date) {\n let currentTime = date ? new Date(date) : new Date();\n let currentOffset = dat...
[ "0.6852997", "0.6852997", "0.66000175", "0.64474636", "0.6234923", "0.6171766", "0.60891175", "0.6050031", "0.59065974", "0.5902533", "0.5902533", "0.5902533", "0.5865114", "0.58583325", "0.58446234", "0.5819917", "0.5819917", "0.5757572", "0.56975555", "0.5696399", "0.568664...
0.6656873
4
day offset > cell offset
function dayOffsetToCellOffset(dayOffset) { var day0 = t.visStart.getDay(); // first date's day of week dayOffset += day0; // normalize dayOffset to beginning-of-week return Math.floor(dayOffset / 7) * cellsPerWeek // # of cells from full weeks + dayToCellMap[ // # of cells from partial last week (dayOffset % 7 + 7) % 7 // crazy math to handle negative dayOffsets ] - dayToCellMap[day0]; // adjustment for beginning-of-week normalization }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function dayOffsetToCellOffset(dayOffset) {\n\t\tvar day0 = t.start.day(); // first date's day of week\n\t\tdayOffset += day0; // normalize dayOffset to beginning-of-week\n\t\treturn Math.floor(dayOffset / 7) * cellsPerWeek + // # of cells from full weeks\n\t\t\tdayToCellMap[ // # of cells from partial last week\n...
[ "0.72008353", "0.72008353", "0.70878965", "0.70878965", "0.70878965", "0.6954092", "0.6954092", "0.6010348", "0.6002575", "0.59744346", "0.594818", "0.5759046", "0.57272", "0.57272", "0.57272", "0.56868136", "0.56868136", "0.56868136", "0.56868136", "0.56868136", "0.56635463"...
0.7304595
2
cell offset > cell (object with row & col keys)
function cellOffsetToCell(cellOffset) { var colCnt = t.getColCnt(); // rtl variables. wish we could pre-populate these. but where? var dis = isRTL ? -1 : 1; var dit = isRTL ? colCnt - 1 : 0; var row = Math.floor(cellOffset / colCnt); var col = ((cellOffset % colCnt + colCnt) % colCnt) * dis + dit; // column, adjusted for RTL (dis & dit) return { row: row, col: col }; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "getCellPosition(column, row) {\n return {x: column * CELL.WIDTH, y: row * CELL.HEIGHT};\n }", "function findPosition(cell) {\n let x = parseInt(cell.attr(\"value\").substring(0, 1));\n let y = parseInt(cell.attr(\"value\").substring(1));\n\n return {\n x: x, \n y: y\n ...
[ "0.7319935", "0.7033716", "0.695381", "0.6703732", "0.66999227", "0.6691894", "0.66752076", "0.6674185", "0.6662619", "0.6582578", "0.65344834", "0.6494026", "0.64531326", "0.6448493", "0.643174", "0.64167917", "0.64167917", "0.64167917", "0.64167917", "0.64167917", "0.637765...
0.6288617
27
Converts a date range into an array of segment objects. "Segments" are horizontal stretches of time, sliced up by row. A segment object has the following properties: row cols isStart isEnd
function rangeToSegments(startDate, endDate) { var rowCnt = t.getRowCnt(); var colCnt = t.getColCnt(); var segments = []; // array of segments to return // day offset for given date range var rangeDayOffsetStart = dateToDayOffset(startDate); var rangeDayOffsetEnd = dateToDayOffset(endDate); // exclusive // first and last cell offset for the given date range // "last" implies inclusivity var rangeCellOffsetFirst = dayOffsetToCellOffset(rangeDayOffsetStart); var rangeCellOffsetLast = dayOffsetToCellOffset(rangeDayOffsetEnd) - 1; // loop through all the rows in the view for (var row=0; row<rowCnt; row++) { // first and last cell offset for the row var rowCellOffsetFirst = row * colCnt; var rowCellOffsetLast = rowCellOffsetFirst + colCnt - 1; // get the segment's cell offsets by constraining the range's cell offsets to the bounds of the row var segmentCellOffsetFirst = Math.max(rangeCellOffsetFirst, rowCellOffsetFirst); var segmentCellOffsetLast = Math.min(rangeCellOffsetLast, rowCellOffsetLast); // make sure segment's offsets are valid and in view if (segmentCellOffsetFirst <= segmentCellOffsetLast) { // translate to cells var segmentCellFirst = cellOffsetToCell(segmentCellOffsetFirst); var segmentCellLast = cellOffsetToCell(segmentCellOffsetLast); // view might be RTL, so order by leftmost column var cols = [ segmentCellFirst.col, segmentCellLast.col ].sort(); // Determine if segment's first/last cell is the beginning/end of the date range. // We need to compare "day offset" because "cell offsets" are often ambiguous and // can translate to multiple days, and an edge case reveals itself when we the // range's first cell is hidden (we don't want isStart to be true). var isStart = cellOffsetToDayOffset(segmentCellOffsetFirst) == rangeDayOffsetStart; var isEnd = cellOffsetToDayOffset(segmentCellOffsetLast) + 1 == rangeDayOffsetEnd; // +1 for comparing exclusively segments.push({ row: row, leftCol: cols[0], rightCol: cols[1], isStart: isStart, isEnd: isEnd }); } } return segments; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function rangeToSegments(start, end) {\n\n\t\tvar rowCnt = t.getRowCnt();\n\t\tvar colCnt = t.getColCnt();\n\t\tvar segments = []; // array of segments to return\n\n\t\t// day offset for given date range\n\t\tvar rangeDayOffsetStart = dateToDayOffset(start);\n\t\tvar rangeDayOffsetEnd = dateToDayOffset(end); // an...
[ "0.81463176", "0.81463176", "0.6855018", "0.6855018", "0.6855018", "0.6250695", "0.6250695", "0.61871886", "0.574625", "0.573311", "0.5600196", "0.5566883", "0.5526703", "0.5526703", "0.5526703", "0.5526703", "0.5526703", "0.5479248", "0.54370505", "0.54349625", "0.5430218", ...
0.8139136
4
Render `events` onto the calendar, attach mouse event handlers, and call the `eventAfterRender` callback for each. Mouse event will be lazily applied, except if the event has an ID of `modifiedEventId`. Can only be called when the event container is empty (because it wipes out all innerHTML).
function renderDayEvents(events, modifiedEventId) { // do the actual rendering. Receive the intermediate "segment" data structures. var segments = _renderDayEvents( events, false, // don't append event elements true // set the heights of the rows ); // report the elements to the View, for general drag/resize utilities segmentElementEach(segments, function(segment, element) { reportEventElement(segment.event, element); }); // attach mouse handlers attachHandlers(segments, modifiedEventId); // call `eventAfterRender` callback for each event segmentElementEach(segments, function(segment, element) { trigger('eventAfterRender', segment.event, segment.event, element); }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function renderEvents() {\n var totalPercent = 100,\n currentEvent,\n curCol,\n width,\n height,\n leftOffset,\n eventText,\n i,\n j;\n \n // empty container before adding new events\n $el.empty();\n \n // go through all columns\n for (i=...
[ "0.6429242", "0.60801613", "0.59193474", "0.59193474", "0.59193474", "0.59193474", "0.59193474", "0.58963716", "0.57918185", "0.5788493", "0.5712636", "0.5667555", "0.56600547", "0.5655115", "0.5643397", "0.5506843", "0.54549485", "0.5450063", "0.5450063", "0.5450063", "0.545...
0.7325389
4
Render an event on the calendar, but don't report them anywhere, and don't attach mouse handlers. Append this event element to the event container, which might already be populated with events. If an event's segment will have row equal to `adjustRow`, then explicitly set its top coordinate to `adjustTop`. This hack is used to maintain continuity when user is manually resizing an event. Returns an array of DOM elements for the event.
function renderTempDayEvent(event, adjustRow, adjustTop) { // actually render the event. `true` for appending element to container. // Recieve the intermediate "segment" data structures. var segments = _renderDayEvents( [ event ], true, // append event elements false // don't set the heights of the rows ); var elements = []; // Adjust certain elements' top coordinates segmentElementEach(segments, function(segment, element) { if (segment.row === adjustRow) { element.css('top', adjustTop); } elements.push(element[0]); // accumulate DOM nodes }); return elements; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function renderEvents() {\n var totalPercent = 100,\n currentEvent,\n curCol,\n width,\n height,\n leftOffset,\n eventText,\n i,\n j;\n \n // empty container before adding new events\n $el.empty();\n \n // go through all columns\n for (i=...
[ "0.634602", "0.6183087", "0.6183087", "0.6183087", "0.6183087", "0.6183087", "0.59750706", "0.57429993", "0.56913275", "0.56305313", "0.56025356", "0.5542823", "0.55423117", "0.55208945", "0.5511898", "0.5511898", "0.5511898", "0.54841495", "0.54676336", "0.543681", "0.542840...
0.7342362
4
Render events onto the calendar. Only responsible for the VISUAL aspect. Not responsible for attaching handlers or calling callbacks. Set `doAppend` to `true` for rendering elements without clearing the existing container. Set `doRowHeights` to allow setting the height of each row, to compensate for vertical event overflow.
function _renderDayEvents(events, doAppend, doRowHeights) { // where the DOM nodes will eventually end up var finalContainer = getDaySegmentContainer(); // the container where the initial HTML will be rendered. // If `doAppend`==true, uses a temporary container. var renderContainer = doAppend ? $("<div/>") : finalContainer; var segments = buildSegments(events); var html; var elements; // calculate the desired `left` and `width` properties on each segment object calculateHorizontals(segments); // build the HTML string. relies on `left` property html = buildHTML(segments); // render the HTML. innerHTML is considerably faster than jQuery's .html() renderContainer[0].innerHTML = html; // retrieve the individual elements elements = renderContainer.children(); // if we were appending, and thus using a temporary container, // re-attach elements to the real container. if (doAppend) { finalContainer.append(elements); } // assigns each element to `segment.event`, after filtering them through user callbacks resolveElements(segments, elements); // Calculate the left and right padding+margin for each element. // We need this for setting each element's desired outer width, because of the W3C box model. // It's important we do this in a separate pass from acually setting the width on the DOM elements // because alternating reading/writing dimensions causes reflow for every iteration. segmentElementEach(segments, function(segment, element) { segment.hsides = hsides(element, true); // include margins = `true` }); // Set the width of each element segmentElementEach(segments, function(segment, element) { element.width( Math.max(0, segment.outerWidth - segment.hsides) ); }); // Grab each element's outerHeight (setVerticals uses this). // To get an accurate reading, it's important to have each element's width explicitly set already. segmentElementEach(segments, function(segment, element) { segment.outerHeight = element.outerHeight(true); // include margins = `true` }); // Set the top coordinate on each element (requires segment.outerHeight) setVerticals(segments, doRowHeights); return segments; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function renderEvents() {\n var totalPercent = 100,\n currentEvent,\n curCol,\n width,\n height,\n leftOffset,\n eventText,\n i,\n j;\n \n // empty container before adding new events\n $el.empty();\n \n // go through all columns\n for (i=...
[ "0.76320183", "0.6999267", "0.6678074", "0.6403235", "0.6403235", "0.6403235", "0.6403235", "0.6403235", "0.63051385", "0.62821454", "0.61530083", "0.613791", "0.6132166", "0.60849655", "0.59580624", "0.59524786", "0.5893744", "0.58742917", "0.5814716", "0.57570153", "0.57523...
0.7676496
4
Generate an array of "segments" for all events.
function buildSegments(events) { var segments = []; for (var i=0; i<events.length; i++) { var eventSegments = buildSegmentsForEvent(events[i]); segments.push.apply(segments, eventSegments); // append an array to an array } return segments; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function buildSegmentsForEvent(event) {\n\t\tvar segments = rangeToSegments(event.start, getEventEnd(event));\n\t\tfor (var i=0; i<segments.length; i++) {\n\t\t\tsegments[i].event = event;\n\t\t}\n\t\treturn segments;\n\t}", "function buildSegmentsForEvent(event) {\n\t\tvar segments = rangeToSegments(event.start...
[ "0.74763757", "0.74763757", "0.7386226", "0.7386226", "0.7386226", "0.5799539", "0.56912214", "0.5663445", "0.56329834", "0.55707103", "0.55707103", "0.55707103", "0.55703443", "0.55240005", "0.55240005", "0.54700834", "0.54283106", "0.5423508", "0.5364946", "0.5346535", "0.5...
0.79953575
4
Generate an array of segments for a single event. A "segment" is the same data structure that View.rangeToSegments produces, with the addition of the `event` property being set to reference the original event.
function buildSegmentsForEvent(event) { var startDate = event.start; var endDate = exclEndDay(event); var segments = rangeToSegments(startDate, endDate); for (var i=0; i<segments.length; i++) { segments[i].event = event; } return segments; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function buildSegmentsForEvent(event) {\n\t\tvar segments = rangeToSegments(event.start, getEventEnd(event));\n\t\tfor (var i=0; i<segments.length; i++) {\n\t\t\tsegments[i].event = event;\n\t\t}\n\t\treturn segments;\n\t}", "function buildSegmentsForEvent(event) {\n\t\tvar segments = rangeToSegments(event.start...
[ "0.78385335", "0.78385335", "0.686349", "0.686349", "0.686349", "0.686349", "0.686349", "0.62948906", "0.62948906", "0.6217088", "0.6217088", "0.6217088", "0.5959591", "0.5729146", "0.5511071", "0.5511071", "0.5511071", "0.5481921", "0.5481921", "0.5481921", "0.5268053", "0...
0.77784616
4
Sets the `left` and `outerWidth` property of each segment. These values are the desired dimensions for the eventual DOM elements.
function calculateHorizontals(segments) { var isRTL = opt('isRTL'); for (var i=0; i<segments.length; i++) { var segment = segments[i]; // Determine functions used for calulating the elements left/right coordinates, // depending on whether the view is RTL or not. // NOTE: // colLeft/colRight returns the coordinate butting up the edge of the cell. // colContentLeft/colContentRight is indented a little bit from the edge. var leftFunc = (isRTL ? segment.isEnd : segment.isStart) ? colContentLeft : colLeft; var rightFunc = (isRTL ? segment.isStart : segment.isEnd) ? colContentRight : colRight; var left = leftFunc(segment.leftCol); var right = rightFunc(segment.rightCol); segment.left = left; segment.outerWidth = right - left; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function setBoxWidths() {\n var leftWidth = dragBarPos - 2,\n rightWidth = outerWidth - dragBarPos - 12;\n\n left.css('width', '' + toPercent(leftWidth) + '%');\n right.css('width', '' + toPercent(rightWidth) + '%');\n }", "function d(b,c,d){\n// where the...
[ "0.6089321", "0.6069712", "0.59779614", "0.5766409", "0.5672508", "0.56574285", "0.56330174", "0.5585594", "0.5495316", "0.54615843", "0.54418087", "0.543307", "0.5416333", "0.5406196", "0.53927106", "0.5370731", "0.5334605", "0.5294546", "0.5289315", "0.5287091", "0.5258876"...
0.7059363
4
Build a concatenated HTML string for an array of segments
function buildHTML(segments) { var html = ''; for (var i=0; i<segments.length; i++) { html += buildHTMLForSegment(segments[i]); } return html; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function combineSegments() {\n\t\tvar result = '';\n\t\ttotalSegments = segments.length;\n\t\tfor (var i = 0; i < segments.length; i++) {\n\t\t\tif (segments[i].isEmpty()) {\n\t\t\t\ttotalSegments--;\n\t\t\t\tcontinue;\n\t\t\t\t\n\t\t\t}\n\t\t\tresult += segments[i].asText();\n\t\t}\n\t\treturn result;\n\t}", "f...
[ "0.6436715", "0.6024399", "0.6024399", "0.6024399", "0.5998631", "0.5996163", "0.5639905", "0.54803085", "0.5434722", "0.5406663", "0.54057944", "0.54003", "0.5374191", "0.53732914", "0.536657", "0.5340935", "0.53226066", "0.5321825", "0.53137153", "0.52845955", "0.5265781", ...
0.84847665
4
Build an HTML string for a single segment. Relies on the following properties: `segment.event` (from `buildSegmentsForEvent`) `segment.left` (from `calculateHorizontals`)
function buildHTMLForSegment(segment) { var html = ''; var isRTL = opt('isRTL'); var event = segment.event; var url = event.url; // generate the list of CSS classNames var classNames = [ 'fc-event', 'fc-event-hori' ]; if (isEventDraggable(event)) { classNames.push('fc-event-draggable'); } if (segment.isStart) { classNames.push('fc-event-start'); } if (segment.isEnd) { classNames.push('fc-event-end'); } // use the event's configured classNames // guaranteed to be an array via `normalizeEvent` classNames = classNames.concat(event.className); if (event.source) { // use the event's source's classNames, if specified classNames = classNames.concat(event.source.className || []); } // generate a semicolon delimited CSS string for any of the "skin" properties // of the event object (`backgroundColor`, `borderColor` and such) var skinCss = getSkinCss(event, opt); if (url) { html += "<a href='" + htmlEscape(url) + "'"; }else{ html += "<div"; } html += " class='" + classNames.join(' ') + "'" + " style=" + "'" + "position:absolute;" + "left:" + segment.left + "px;" + skinCss + "'" + ">" + "<div class='fc-event-inner'>"; if (!event.allDay && segment.isStart) { html += "<span class='fc-event-time'>" + htmlEscape( formatDates(event.start, event.end, opt('timeFormat')) ) + "</span>"; } html += "<span class='fc-event-title'>" + htmlEscape(event.title || '') + "</span>" + "</div>"; if (segment.isEnd && isEventResizable(event)) { html += "<div class='ui-resizable-handle ui-resizable-" + (isRTL ? 'w' : 'e') + "'>" + "&nbsp;&nbsp;&nbsp;" + // makes hit area a lot better for IE6/7 "</div>"; } html += "</" + (url ? "a" : "div") + ">"; // TODO: // When these elements are initially rendered, they will be briefly visibile on the screen, // even though their widths/heights are not set. // SOLUTION: initially set them as visibility:hidden ? return html; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function buildHTMLForSegment(segment) {\n\t\tvar html = '';\n\t\tvar isRTL = opt('isRTL');\n\t\tvar event = segment.event;\n\t\tvar url = event.url;\n\n\t\t// generate the list of CSS classNames\n\t\tvar classNames = [ 'fc-event', 'fc-event-hori' ];\n\t\tif (isEventDraggable(event)) {\n\t\t\tclassNames.push('fc-ev...
[ "0.77688015", "0.77162004", "0.77159446", "0.686523", "0.686523", "0.686523", "0.686523", "0.686523", "0.5870318", "0.5782685", "0.5782685", "0.5782685", "0.57573277", "0.57573277", "0.57573277", "0.5573747", "0.55725944", "0.5564377", "0.5564377", "0.5533536", "0.54821306", ...
0.77688015
2
Associate each segment (an object) with an element (a jQuery object), by setting each `segment.element`. Run each element through the `eventRender` filter, which allows developers to modify an existing element, supply a new one, or cancel rendering.
function resolveElements(segments, elements) { for (var i=0; i<segments.length; i++) { var segment = segments[i]; var event = segment.event; var element = elements.eq(i); // call the trigger with the original element var triggerRes = trigger('eventRender', event, event, element); if (triggerRes === false) { // if `false`, remove the event from the DOM and don't assign it to `segment.event` element.remove(); } else { if (triggerRes && triggerRes !== true) { // the trigger returned a new element, but not `true` (which means keep the existing element) // re-assign the important CSS dimension properties that were already assigned in `buildHTMLForSegment` triggerRes = $(triggerRes) .css({ position: 'absolute', left: segment.left }); element.replaceWith(triggerRes); element = triggerRes; } segment.element = element; } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function k(b,c){for(var d=0;d<b.length;d++){var e=b[d],f=e.event,g=c.eq(d),h=z(\"eventRender\",f,f,g);h===!1?\n// if `false`, remove the event from the DOM and don't assign it to `segment.event`\ng.remove():(h&&h!==!0&&(\n// the trigger returned a new element, but not `true` (which means keep the existing element)...
[ "0.6364897", "0.56436723", "0.56436723", "0.56436723", "0.56436723", "0.56436723", "0.5510602", "0.55014265", "0.52851987", "0.5129213", "0.5129213", "0.5129213", "0.5105053", "0.5105053", "0.5105053", "0.5036435", "0.5032565", "0.50104743", "0.5009919", "0.5009919", "0.50099...
0.6660576
4
Topcoordinate Methods Sets the "top" CSS property for each element. If `doRowHeights` is `true`, also sets each row's first cell to an explicit height, so that if elements vertically overflow, the cell expands vertically to compensate.
function setVerticals(segments, doRowHeights) { var rowContentHeights = calculateVerticals(segments); // also sets segment.top var rowContentElements = getRowContentElements(); // returns 1 inner div per row var rowContentTops = []; // Set each row's height by setting height of first inner div if (doRowHeights) { for (var i=0; i<rowContentElements.length; i++) { rowContentElements[i].height(rowContentHeights[i]); } } // Get each row's top, relative to the views's origin. // Important to do this after setting each row's height. for (var i=0; i<rowContentElements.length; i++) { rowContentTops.push( rowContentElements[i].position().top ); } // Set each segment element's CSS "top" property. // Each segment object has a "top" property, which is relative to the row's top, but... segmentElementEach(segments, function(segment, element) { element.css( 'top', rowContentTops[segment.row] + segment.top // ...now, relative to views's origin ); }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function get_top(top){\n\t\t\t\t\tvar row_multiple = row_height*parseInt($rows_id);\n\t\t\t\t\treturn (top + row_multiple) + 'px';\n\t\t\t\t}", "function setVerticals(segments, doRowHeights) {\n\t\tvar rowContentHeights = calculateVerticals(segments); // also sets segment.top\n\t\tvar rowContentElements = getRow...
[ "0.6276385", "0.58950657", "0.58950657", "0.57709444", "0.57136106", "0.5671218", "0.5619804", "0.5388517", "0.53873366", "0.5334823", "0.5295462", "0.5164813", "0.5150496", "0.51462954", "0.51363903", "0.51274616", "0.5125238", "0.5108935", "0.50870574", "0.5080667", "0.5055...
0.58956194
3
Calculate the "top" coordinate for each segment, relative to the "top" of the row. Also, return an array that contains the "content" height for each row (the height displaced by the vertically stacked events in the row). Requires segments to have their `outerHeight` property already set.
function calculateVerticals(segments) { var rowCnt = getRowCnt(); var colCnt = getColCnt(); var rowContentHeights = []; // content height for each row var segmentRows = buildSegmentRows(segments); // an array of segment arrays, one for each row for (var rowI=0; rowI<rowCnt; rowI++) { var segmentRow = segmentRows[rowI]; // an array of running total heights for each column. // initialize with all zeros. var colHeights = []; for (var colI=0; colI<colCnt; colI++) { colHeights.push(0); } // loop through every segment for (var segmentI=0; segmentI<segmentRow.length; segmentI++) { var segment = segmentRow[segmentI]; // find the segment's top coordinate by looking at the max height // of all the columns the segment will be in. segment.top = arrayMax( colHeights.slice( segment.leftCol, segment.rightCol + 1 // make exclusive for slice ) ); // adjust the columns to account for the segment's height for (var colI=segment.leftCol; colI<=segment.rightCol; colI++) { colHeights[colI] = segment.top + segment.outerHeight; } } // the tallest column in the row should be the "content height" rowContentHeights.push(arrayMax(colHeights)); } return rowContentHeights; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function calculateVerticals(segments) {\n\t\tvar rowCnt = getRowCnt();\n\t\tvar colCnt = getColCnt();\n\t\tvar rowContentHeights = []; // content height for each row\n\t\tvar segmentRows = buildSegmentRows(segments); // an array of segment arrays, one for each row\n\t\tvar colI;\n\n\t\tfor (var rowI=0; rowI<rowCnt...
[ "0.7281048", "0.7281048", "0.61131155", "0.61131155", "0.61131155", "0.6069511", "0.6069511", "0.60476625", "0.594145", "0.5938133", "0.5738717", "0.57117665", "0.57117665", "0.57117665", "0.57117665", "0.57117665", "0.56757057", "0.5635003", "0.5635003", "0.5635003", "0.5635...
0.7303135
2
Build an array of segment arrays, each representing the segments that will be in a row of the grid, sorted by which event should be closest to the top.
function buildSegmentRows(segments) { var rowCnt = getRowCnt(); var segmentRows = []; var segmentI; var segment; var rowI; // group segments by row for (segmentI=0; segmentI<segments.length; segmentI++) { segment = segments[segmentI]; rowI = segment.row; if (segment.element) { // was rendered? if (segmentRows[rowI]) { // already other segments. append to array segmentRows[rowI].push(segment); } else { // first segment in row. create new array segmentRows[rowI] = [ segment ]; } } } // sort each row for (rowI=0; rowI<rowCnt; rowI++) { segmentRows[rowI] = sortSegmentRow( segmentRows[rowI] || [] // guarantee an array, even if no segments ); } return segmentRows; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function p(a){\n// Give preference to elements with certain criteria, so they have\n// a chance to be closer to the top.\na.sort(ya);for(var b=[],c=0;c<a.length;c++){\n// loop through subrows, starting with the topmost, until the segment\n// doesn't collide with other segments.\nfor(var d=a[c],e=0;e<b.length&&wa(d...
[ "0.674066", "0.6464115", "0.6464115", "0.6464115", "0.6464115", "0.6464115", "0.63501054", "0.6195871", "0.6195871", "0.6195871", "0.6195871", "0.6195871", "0.6118627", "0.6118627", "0.6118627", "0.6118627", "0.6118627", "0.5906122", "0.580797", "0.57273674", "0.55736226", ...
0.6676458
5
Sort an array of segments according to which segment should appear closest to the top
function sortSegmentRow(segments) { var sortedSegments = []; // build the subrow array var subrows = buildSegmentSubrows(segments); // flatten it for (var i=0; i<subrows.length; i++) { sortedSegments.push.apply(sortedSegments, subrows[i]); // append an array to an array } return sortedSegments; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function p(a){\n// Give preference to elements with certain criteria, so they have\n// a chance to be closer to the top.\na.sort(ya);for(var b=[],c=0;c<a.length;c++){\n// loop through subrows, starting with the topmost, until the segment\n// doesn't collide with other segments.\nfor(var d=a[c],e=0;e<b.length&&wa(d...
[ "0.6719922", "0.66121286", "0.66121286", "0.66049504", "0.65933216", "0.61828715", "0.6057642", "0.59956145", "0.598598", "0.5968806", "0.5950562", "0.5917225", "0.59000415", "0.589969", "0.5897684", "0.5897684", "0.5897684", "0.5897684", "0.5897684", "0.5888729", "0.5870634"...
0.6348776
9
Take an array of segments, which are all assumed to be in the same row, and sort into subrows.
function buildSegmentSubrows(segments) { // Give preference to elements with certain criteria, so they have // a chance to be closer to the top. segments.sort(compareDaySegments); var subrows = []; for (var i=0; i<segments.length; i++) { var segment = segments[i]; // loop through subrows, starting with the topmost, until the segment // doesn't collide with other segments. for (var j=0; j<subrows.length; j++) { if (!isDaySegmentCollision(segment, subrows[j])) { break; } } // `j` now holds the desired subrow index if (subrows[j]) { subrows[j].push(segment); } else { subrows[j] = [ segment ]; } } return subrows; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function sortSegmentRow(segments) {\n\t\tvar sortedSegments = [];\n\n\t\t// build the subrow array\n\t\tvar subrows = buildSegmentSubrows(segments);\n\n\t\t// flatten it\n\t\tfor (var i=0; i<subrows.length; i++) {\n\t\t\tsortedSegments.push.apply(sortedSegments, subrows[i]); // append an array to an array\n\t\t}\n...
[ "0.8082138", "0.8082138", "0.8082138", "0.8082138", "0.8082138", "0.7460866", "0.7460866", "0.7460866", "0.7460866", "0.7460866", "0.6793623", "0.61897725", "0.59009707", "0.5883837", "0.5867502", "0.5812204", "0.57381237", "0.5732497", "0.5632513", "0.5604843", "0.5562429", ...
0.7234669
14
Return an array of jQuery objects for the placeholder content containers of each row. The content containers don't actually contain anything, but their dimensions should match the events that are overlaid on top.
function getRowContentElements() { var i; var rowCnt = getRowCnt(); var rowDivs = []; for (i=0; i<rowCnt; i++) { rowDivs[i] = allDayRow(i) .find('div.fc-day-content > div'); } return rowDivs; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function createContainers() {\n\t\t\t\t//console.log('Creating containers...');\n\t\t\t\t// Define html to be prepended to the body\n\t\t\t\tvar qfInner = \"<div id=\\\"qfCloseContainer\\\">&times;</div>\\n<div id=\\\"qfSheetContent\\\"></div>\";\n\t var qfSheetContainer = \"<div id=\\\"qfSh...
[ "0.56500405", "0.56076294", "0.5530091", "0.54244584", "0.5384703", "0.5384525", "0.53821254", "0.5333401", "0.53023034", "0.5292985", "0.52698934", "0.5239339", "0.52305394", "0.5220376", "0.5213112", "0.5203076", "0.518051", "0.51711327", "0.5167701", "0.5161365", "0.515684...
0.6634207
4
Mouse Handlers TODO: better documentation!
function attachHandlers(segments, modifiedEventId) { var segmentContainer = getDaySegmentContainer(); segmentElementEach(segments, function(segment, element, i) { var event = segment.event; if (event._id === modifiedEventId) { bindDaySeg(event, element, segment); }else{ element[0]._fci = i; // for lazySegBind } }); lazySegBind(segmentContainer, segments, bindDaySeg); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function addMouseHandlers() {\n container.addEventListener('mousedown', function(evt) {\n // console.log('mousedown', evt);\n lastX = evt.screenX;\n container.addEventListener('mousemove', mousemove);\n container.addEventListener('mouseup', function(e) {\n container.removeEventListener('mousemo...
[ "0.7324703", "0.7260839", "0.72045994", "0.7155521", "0.71366787", "0.7069288", "0.7034779", "0.7017266", "0.6984869", "0.6973881", "0.6893609", "0.68902594", "0.68902594", "0.68422985", "0.6834637", "0.6834637", "0.6806476", "0.6787211", "0.67554736", "0.6753242", "0.6751489...
0.0
-1
A cmp function for determining which segments should appear higher up
function compareDaySegments(a, b) { return (b.rightCol - b.leftCol) - (a.rightCol - a.leftCol) || // put wider events first b.event.allDay - a.event.allDay || // if tie, put all-day events first (booleans cast to 0/1) a.event.start - b.event.start || // if a tie, sort by event start date (a.event.title || '').localeCompare(b.event.title) // if a tie, sort by event title }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function compareForwardSlotSegs(seg1, seg2) {\n\t// put higher-pressure first\n\treturn seg2.forwardPressure - seg1.forwardPressure ||\n\t\t// put segments that are closer to initial edge first (and favor ones with no coords yet)\n\t\t(seg1.backwardCoord || 0) - (seg2.backwardCoord || 0) ||\n\t\t// do normal sorti...
[ "0.68104255", "0.68104255", "0.68104255", "0.68104255", "0.68104255", "0.68073845", "0.68073845", "0.68017423", "0.67930675", "0.67886555", "0.647651", "0.647651", "0.64620286", "0.6412865", "0.6311878", "0.6311878", "0.6311878", "0.6311878", "0.6311878", "0.6202975", "0.6177...
0.64816463
12
BUG: unselect needs to be triggered when events are dragged+dropped
function SelectionManager() { var t = this; // exports t.select = select; t.unselect = unselect; t.reportSelection = reportSelection; t.daySelectionMousedown = daySelectionMousedown; // imports var opt = t.opt; var trigger = t.trigger; var defaultSelectionEnd = t.defaultSelectionEnd; var renderSelection = t.renderSelection; var clearSelection = t.clearSelection; // locals var selected = false; // unselectAuto if (opt('selectable') && opt('unselectAuto')) { $(document).mousedown(function(ev) { var ignore = opt('unselectCancel'); if (ignore) { if ($(ev.target).parents(ignore).length) { // could be optimized to stop after first match return; } } unselect(ev); }); } function select(startDate, endDate, allDay) { unselect(); if (!endDate) { endDate = defaultSelectionEnd(startDate, allDay); } renderSelection(startDate, endDate, allDay); reportSelection(startDate, endDate, allDay); } function unselect(ev) { if (selected) { selected = false; clearSelection(); trigger('unselect', null, ev); } } function reportSelection(startDate, endDate, allDay, ev) { selected = true; trigger('select', null, startDate, endDate, allDay, ev); } function daySelectionMousedown(ev) { // not really a generic manager method, oh well var cellToDate = t.cellToDate; var getIsCellAllDay = t.getIsCellAllDay; var hoverListener = t.getHoverListener(); var reportDayClick = t.reportDayClick; // this is hacky and sort of weird if (ev.which == 1 && opt('selectable')) { // which==1 means left mouse button unselect(ev); var _mousedownElement = this; var dates; hoverListener.start(function(cell, origCell) { // TODO: maybe put cellToDate/getIsCellAllDay info in cell clearSelection(); if (cell && getIsCellAllDay(cell)) { dates = [ cellToDate(origCell), cellToDate(cell) ].sort(dateCompare); renderSelection(dates[0], dates[1], true); }else{ dates = null; } }, ev); $(document).one('mouseup', function(ev) { hoverListener.stop(); if (dates) { if (+dates[0] == +dates[1]) { reportDayClick(dates[0], true, ev); } reportSelection(dates[0], dates[1], true, ev); } }); } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "mouseUp(e){\n this._super(...arguments);\n\n\n if(e.path === undefined || e.path[0].tagName !== \"MULTI-SELECTION\"){\n return;\n }\n\n if(e.button == 0){\n e.stopPropagation();\n e.preventDefault();\n\n this.set('moveStart', false);\n }\n\n\n\n document.removeEventListener('m...
[ "0.72532904", "0.7226916", "0.7092223", "0.70388925", "0.70388925", "0.69625396", "0.6955938", "0.68489724", "0.68049777", "0.67666954", "0.67568", "0.67011136", "0.66772693", "0.66699535", "0.6656235", "0.6650069", "0.65917", "0.6569573", "0.65628904", "0.65607536", "0.65462...
0.0
-1
this fix was only necessary for jQuery UI 1.8.16 (and jQuery 1.7 or 1.7.1) upgrading to jQuery UI 1.8.17 (and using either jQuery 1.7 or 1.7.1) fixed the problem but keep this in here for 1.8.16 users and maybe remove it down the line
function _fixUIEvent(event) { // for issue 1168 if (event.pageX === undefined) { event.pageX = event.originalEvent.pageX; event.pageY = event.originalEvent.pageY; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function initjQueryUI() {\n var availableCategories = [\n \"category_01\",\n \"category_02\",\n \"category_03\",\n \"category_04\",\n \"category_05\",\n \"category_06\",\n \"category_07\",\n \"category_08\",\n \"category_09\",\n \"category_10...
[ "0.6307197", "0.5536199", "0.5474077", "0.54319423", "0.542164", "0.54143", "0.52779704", "0.5277193", "0.5266619", "0.5232998", "0.521053", "0.521053", "0.519546", "0.51255226", "0.5121184", "0.5111813", "0.50935936", "0.50847435", "0.50847435", "0.5067298", "0.5058299", "...
0.53465104
9
Rutina principal Setup inicial
function setup() { try { let resWidth = windowWidth; let resHeight = windowHeight; let auxWidth = 0; let auxHeight = 0; let x_ini = 2; let y_ini = 2; let x = x_ini; let y = y_ini; createCanvas(resWidth, resHeight); textFont('Courier'); textSize(20); PreLoadOscillator(); //Osciladores ActivarMic(); //Preparar la captura de microfono gb_ctrl_areaRX = createElement('textarea'); gb_ctrl_areaRX.position(x_ini,y_ini); auxWidth = resWidth - x_ini - 40; gb_ctrl_areaRX.style('width',auxWidth.toString()+'px'); auxHeight = Math.trunc(resHeight/2.2); gb_ctrl_areaRX.style('height',auxHeight.toString()+'px'); gb_ctrl_areaRX.elt.value=''; gb_ctrl_areaRX.elt.placeholder=''; gb_ctrl_areaRX.elt.readOnly = true; value_stq= value_q4= value_q3= value_q2 = value_q1 = 0; //value_stq_antes = value_q4_antes = value_q3_antes = value_q2_antes = value_q1_antes = 0; gb_ctrl_btnClear = createButton('Clear RX'); x = Math.trunc(resWidth/1.4); y = Math.trunc(resHeight/1.75); gb_ctrl_btnClear.position(x, y); gb_ctrl_btnClear.mousePressed(ClearDtmf); btnStop = createButton('Stop'); x = Math.trunc(resWidth/1.4); y = Math.trunc(resHeight/1.60); btnStop.position(x,y); btnStop.mousePressed(StopSound); //gb_ctrl_btnPruebaSendDTMF = createButton('Send'); //gb_ctrl_btnPruebaSendDTMF.position(220, 290); //gb_ctrl_btnPruebaSendDTMF.mousePressed(PruebaSendDTMF); gb_ctrl_areaTX = createElement('textarea'); y = Math.trunc(resHeight/2.1) + y_ini; gb_ctrl_areaTX.position(x_ini,y); auxWidth = Math.trunc((resWidth - x_ini)/1.9) ; gb_ctrl_areaTX.style('width', auxWidth.toString()+'px'); gb_ctrl_areaTX.style('height','30px'); gb_ctrl_areaTX.elt.maxLength = const_max_length_sms; gb_ctrl_areaTX.elt.placeholder=''; gb_ctrl_btnPruebaSendTX0 = createButton('Send TX'); x = Math.trunc(resWidth/1.75); y = Math.trunc(resHeight/2.05); gb_ctrl_btnPruebaSendTX0.position(x, y); gb_ctrl_btnPruebaSendTX0.mousePressed(function(){SendTXSMSTipo(gb_use_sms)}); //gb_ctrl_btnPruebaSendSMS0 = createButton('SendSMS0'); //x = Math.trunc(resWidth/1.4); //y = Math.trunc(resHeight/2.1); //gb_ctrl_btnPruebaSendSMS0.position(x, y); //gb_ctrl_btnPruebaSendSMS0.mousePressed(function(){SendSMSTipo0('HOLA')}); gb_ctrl_cmbSMS = createSelect(); x = Math.trunc(resWidth/1.4); y = Math.trunc(resHeight/2.1); gb_ctrl_cmbSMS.position(x, y); gb_ctrl_cmbSMS.option('0.RAW'); gb_ctrl_cmbSMS.option('1.Diccionario'); gb_ctrl_cmbSMS.option('2.LZW'); gb_ctrl_cmbSMS.option('3.Auto'); switch (gb_use_sms) { case 0: gb_ctrl_cmbSMS.selected('0.RAW'); //Base64 crudo break; case 1: gb_ctrl_cmbSMS.selected('1.Diccionario'); //Diccionario, empaqueta, mayusculas Base64 break; case 2: gb_ctrl_cmbSMS.selected('2.LZW'); //LZW Base64 break; case 3: gb_ctrl_cmbSMS.selected('3.Auto'); //Auto 0,1,2,3 break; default: gb_ctrl_cmbSMS.selected('0.Sin comprimir'); break; } gb_ctrl_cmbSMS.changed(UseSMSEvent); //gb_ctrl_btnPruebaSendSMS1 = createButton('SendSMS1'); //x = Math.trunc(resWidth/1.4); //y = Math.trunc(resHeight/1.9); //gb_ctrl_btnPruebaSendSMS1.position(x, y); //gb_ctrl_btnPruebaSendSMS1.mousePressed(function(){SendSMSTipo1('HOLA QUE TAL')}); gb_ctrl_lbl_stq = createElement('h4', 'STQ'); //label gb_ctrl_lbl_stq.position(20,180); gb_ctrl_input_stq = createInput(gb_id_stq.toString(),'number'); //input gb_ctrl_input_stq.position(60, 200); gb_ctrl_input_stq.style('width','40px'); gb_ctrl_input_stq.elt.min = 0; gb_ctrl_input_stq.elt.max = 99; gb_ctrl_input_stq.input(LoadBotones); gb_ctrl_input_stq.elt.value = gb_id_stq.toString(); gb_ctrl_lbl_q4 = createElement('h4', 'Q4'); //label gb_ctrl_lbl_q4.position(20,210); gb_ctrl_input_q4 = createInput(gb_id_q4.toString(),'number'); //input gb_ctrl_input_q4.position(60, 230); gb_ctrl_input_q4.style('width','40px'); gb_ctrl_input_q4.elt.min = 0; gb_ctrl_input_q4.elt.max = 99; gb_ctrl_input_q4.input(LoadBotones); gb_ctrl_input_q4.elt.value = gb_id_q4.toString(); gb_ctrl_lbl_q3 = createElement('h4', 'Q3'); //label gb_ctrl_lbl_q3.position(20,240); gb_ctrl_input_q3 = createInput(gb_id_q3.toString(),'number'); //input gb_ctrl_input_q3.position(60, 260); gb_ctrl_input_q3.style('width','40px'); gb_ctrl_input_q3.elt.min = 0; gb_ctrl_input_q3.elt.max = 99; gb_ctrl_input_q3.input(LoadBotones); gb_ctrl_input_q3.elt.value = gb_id_q3.toString(); gb_ctrl_lbl_q2 = createElement('h4', 'Q2'); //label gb_ctrl_lbl_q2.position(20,270); gb_ctrl_input_q2 = createInput(gb_id_q2.toString(),'number'); //input gb_ctrl_input_q2.position(60, 290); gb_ctrl_input_q2.style('width','40px'); gb_ctrl_input_q2.elt.min = 0; gb_ctrl_input_q2.elt.max = 99; gb_ctrl_input_q2.input(LoadBotones); gb_ctrl_input_q2.elt.value = gb_id_q2.toString(); gb_ctrl_lbl_q1 = createElement('h4', 'Q1'); //label gb_ctrl_lbl_q1.position(20,300); gb_ctrl_input_q1 = createInput(gb_id_q1.toString(),'number'); //input gb_ctrl_input_q1.position(60, 320); gb_ctrl_input_q1.style('width','40px'); gb_ctrl_input_q1.elt.min = 0; gb_ctrl_input_q1.elt.max = 99; gb_ctrl_input_q1.input(LoadBotones); gb_ctrl_input_q1.elt.value = gb_id_q1.toString(); gb_ctrl_btnTabRX = createButton('TABRX'); gb_ctrl_btnTabRX.position(10,400); gb_ctrl_btnTabRX.mousePressed(SelectTabRX); gb_ctrl_btnTabPAD = createButton('TABPAD'); gb_ctrl_btnTabPAD.position(80,400); gb_ctrl_btnTabPAD.mousePressed(SelectTabPAD); gb_ctrl_chkboxPAD = createCheckbox('GAMEPAD', gb_use_gamepad_dtmf); //checkbox joystick gb_ctrl_chkboxPAD.position(20,20); gb_ctrl_chkboxPAD.changed(GamePADEvent); gb_ctrl_chkboxMic = createCheckbox('Micrófono', gb_use_mic_dtmf);//checkbox mic gb_ctrl_chkboxMic.position(20,50); gb_ctrl_chkboxMic.changed(MicEvent); gb_ctrl_lbl_ptt = createElement('h4', 'PTT'); //label gb_ctrl_lbl_ptt.position(20,60); gb_ctrl_input_ptt = createInput(gb_cadPTT.length.toString(),'number'); //PTT num D a enviar gb_ctrl_input_ptt.position(60, 80); gb_ctrl_input_ptt.style('width','40px'); gb_ctrl_input_ptt.elt.min = 0; gb_ctrl_input_ptt.elt.max = 16; gb_ctrl_input_ptt.input(UpdateNumPTT); gb_ctrl_input_ptt.elt.value = gb_cadPTT.length.toString(); gb_ctrl_lbl_silenceStart = createElement('h4', 'Silence Start'); //label gb_ctrl_lbl_silenceStart.position(200,60); gb_ctrl_input_silenceStart = createInput(gb_cadSilenceStart.length.toString(),'number'); gb_ctrl_input_silenceStart.position(290, 80); gb_ctrl_input_silenceStart.style('width','40px'); gb_ctrl_input_silenceStart.elt.min = 0; gb_ctrl_input_silenceStart.elt.max = 16; gb_ctrl_input_silenceStart.input(UpdateSilenceStart); gb_ctrl_input_silenceStart.elt.value = gb_cadSilenceStart.length.toString(); gb_ctrl_lbl_silenceEnd = createElement('h4', 'Silence End'); //label gb_ctrl_lbl_silenceEnd.position(200,90); gb_ctrl_input_silenceEnd = createInput(gb_cadSilenceEnd.length.toString(),'number'); gb_ctrl_input_silenceEnd.position(290, 110); gb_ctrl_input_silenceEnd.style('width','40px'); gb_ctrl_input_silenceEnd.elt.min = 0; gb_ctrl_input_silenceEnd.elt.max = 16; gb_ctrl_input_silenceEnd.input(UpdateSilenceEnd); gb_ctrl_input_silenceEnd.elt.value = gb_cadSilenceEnd.length.toString(); gb_ctrl_lbl_NoiseEnd = createElement('h4', 'Noise End'); //label ruido antes de soltar PTT gb_ctrl_lbl_NoiseEnd.position(200,120); gb_ctrl_input_NoiseEnd = createInput(gb_cadNoiseEnd.length.toString(),'number'); gb_ctrl_input_NoiseEnd.position(290, 140); gb_ctrl_input_NoiseEnd.style('width','40px'); gb_ctrl_input_NoiseEnd.elt.min = 0; gb_ctrl_input_NoiseEnd.elt.max = 16; gb_ctrl_input_NoiseEnd.input(UpdateNoiseEnd); gb_ctrl_input_NoiseEnd.elt.value = gb_cadNoiseEnd.length.toString(); gb_ctrl_chkbox_fullduplex = createCheckbox('Full duplex', gb_fullduplex); //TX y RX al mismo tiempo gb_ctrl_chkbox_fullduplex.position(20,110); gb_ctrl_chkbox_fullduplex.changed(FullDuplexEvent); gb_ctrl_chkbox_log = createCheckbox('Log Debug', gb_log_debug); //TX y RX al mismo tiempo gb_ctrl_chkbox_log.position(20,140); gb_ctrl_chkbox_log.changed(LogDebugEvent); gb_ctrl_lbl_speed_dtmf = createElement('h4', 'Vel'); //label gb_ctrl_lbl_speed_dtmf.position(20,150); gb_ctrl_input_speed_dtmf = createInput(gb_speed_dtmf.toString(),'number'); //input gb_ctrl_input_speed_dtmf.position(60, 170); gb_ctrl_input_speed_dtmf.style('width','40px'); gb_ctrl_input_speed_dtmf.elt.min = 1; gb_ctrl_input_speed_dtmf.elt.max = 9; gb_ctrl_input_speed_dtmf.input(SpeedEvent); gb_ctrl_input_speed_dtmf.elt.value = gb_speed_dtmf.toString(); SpeedEvent(); //Fuerza la velocidad leida gb_ctrl_chkboxRelay = createCheckbox('Relay PTT', gb_use_relay); //checkbox relay PTT gb_ctrl_chkboxRelay.position(200,20); gb_ctrl_chkboxRelay.changed(RelayEvent); SelectTabRX(); //Seleccion Recepcion gb_forceDraw = true; } catch(err) { DebugLog(err.message.toString()); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "_startUp()\n {\n // Check debug.\n if (RodanClientCore.config.DEBUG)\n {\n Radio.tuneIn('rodan');\n }\n\n this._initializeRadio();\n this._initializeControllers();\n this._initializeBehaviors();\n this._initializeDateTimeFormatter();\n th...
[ "0.6613927", "0.63088226", "0.6110194", "0.6110194", "0.6110194", "0.6109565", "0.6084225", "0.60768753", "0.6016949", "0.5985373", "0.5927671", "0.58595216", "0.58460397", "0.57942945", "0.577629", "0.57548726", "0.57446545", "0.57350683", "0.568855", "0.5664501", "0.5656370...
0.0
-1
Numero de ruido C despues de apretar PTT
function UpdateNoiseEnd() { try { let numNoise = Number(gb_ctrl_input_NoiseEnd.elt.value); let i=0; gb_cadNoiseEnd = ''; for (i=0;i<numNoise;i++) { gb_cadNoiseEnd += 'D'; } } catch(err) { DebugLog(err.message.toString()); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function parse_PtgNum(blob) {\n blob.l++;\n return parse_Xnum(blob, 8);\n }", "function parse_PtgNum(blob) { blob.l++; return parse_Xnum(blob, 8); }", "function parse_PtgNum(blob) { blob.l++; return parse_Xnum(blob, 8); }", "function parse_PtgNum(blob) { blob.l++; return parse_Xnum(blob, 8...
[ "0.6806797", "0.6768867", "0.6768867", "0.6768867", "0.6768867", "0.654325", "0.6238025", "0.61022437", "0.6010143", "0.5980686", "0.5901681", "0.58970225", "0.5875852", "0.58492404", "0.5847169", "0.5842092", "0.58377165", "0.5801582", "0.5793361", "0.578973", "0.5762895", ...
0.0
-1
Numero de silencios despues de apretar PTT
function UpdateSilenceStart() { try { let numSilence = Number(gb_ctrl_input_silenceStart.elt.value); let i=0; gb_cadSilenceStart = ''; for (i=0;i<numSilence;i++) { gb_cadSilenceStart += ' '; } } catch(err) { DebugLog(err.message.toString()); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function parse_PtgNum(blob) { blob.l++; return parse_Xnum(blob, 8); }", "function parse_PtgNum(blob) { blob.l++; return parse_Xnum(blob, 8); }", "function parse_PtgNum(blob) { blob.l++; return parse_Xnum(blob, 8); }", "function parse_PtgNum(blob) { blob.l++; return parse_Xnum(blob, 8); }", "function parse_...
[ "0.66337395", "0.66337395", "0.66337395", "0.66337395", "0.6522298", "0.61597145", "0.6148706", "0.6130095", "0.59716064", "0.5933832", "0.59101164", "0.5872051", "0.58706427", "0.58706427", "0.58706427", "0.58706427", "0.5818374", "0.5746194", "0.5697478", "0.5629841", "0.56...
0.0
-1