code
stringlengths
2
1.05M
repo_name
stringlengths
5
114
path
stringlengths
4
991
language
stringclasses
1 value
license
stringclasses
15 values
size
int32
2
1.05M
jsonp({"cep":"93037260","logradouro":"Rua Lageado","bairro":"Santa Teresa","cidade":"S\u00e3o Leopoldo","uf":"RS","estado":"Rio Grande do Sul"});
lfreneda/cepdb
api/v1/93037260.jsonp.js
JavaScript
cc0-1.0
146
jsonp({"cep":"74583350","logradouro":"Avenida Central","bairro":"Setor Empresarial","cidade":"Goi\u00e2nia","uf":"GO","estado":"Goi\u00e1s"});
lfreneda/cepdb
api/v1/74583350.jsonp.js
JavaScript
cc0-1.0
143
jsonp({"cep":"83045650","logradouro":"Rua dos Papagaios","bairro":"Avia\u00e7\u00e3o","cidade":"S\u00e3o Jos\u00e9 dos Pinhais","uf":"PR","estado":"Paran\u00e1"});
lfreneda/cepdb
api/v1/83045650.jsonp.js
JavaScript
cc0-1.0
164
jsonp({"cep":"05883010","logradouro":"Rua C\u00e1spio","bairro":"Jardim do Col\u00e9gio","cidade":"S\u00e3o Paulo","uf":"SP","estado":"S\u00e3o Paulo"});
lfreneda/cepdb
api/v1/05883010.jsonp.js
JavaScript
cc0-1.0
154
jsonp({"cep":"59080110","logradouro":"Rua Acre","bairro":"Ne\u00f3polis","cidade":"Natal","uf":"RN","estado":"Rio Grande do Norte"});
lfreneda/cepdb
api/v1/59080110.jsonp.js
JavaScript
cc0-1.0
134
jsonp({"cep":"02129065","logradouro":"Pra\u00e7a do Imigrante Boliviano","bairro":"Vila Maria Alta","cidade":"S\u00e3o Paulo","uf":"SP","estado":"S\u00e3o Paulo"});
lfreneda/cepdb
api/v1/02129065.jsonp.js
JavaScript
cc0-1.0
165
jsonp({"cep":"72314404","logradouro":"Quadra QR 518 Conjunto 3","bairro":"Samambaia Sul (Samambaia)","cidade":"Bras\u00edlia","uf":"DF","estado":"Distrito Federal"});
lfreneda/cepdb
api/v1/72314404.jsonp.js
JavaScript
cc0-1.0
167
jsonp({"cep":"69905464","logradouro":"Rua Pau Brasil","bairro":"Cidade Nova","cidade":"Rio Branco","uf":"AC","estado":"Acre"});
lfreneda/cepdb
api/v1/69905464.jsonp.js
JavaScript
cc0-1.0
128
jsonp({"cep":"54777370","logradouro":"Rua Rio Amarelo","bairro":"Santana","cidade":"Camaragibe","uf":"PE","estado":"Pernambuco"});
lfreneda/cepdb
api/v1/54777370.jsonp.js
JavaScript
cc0-1.0
131
jsonp({"cep":"29177045","logradouro":"Travessa Ant\u00f4nio Pereira Madruga","bairro":"S\u00e3o Judas Tadeu","cidade":"Serra","uf":"ES","estado":"Esp\u00edrito Santo"});
lfreneda/cepdb
api/v1/29177045.jsonp.js
JavaScript
cc0-1.0
170
jsonp({"cep":"09931025","logradouro":"Travessa Eufrates","bairro":"Campan\u00e1rio","cidade":"Diadema","uf":"SP","estado":"S\u00e3o Paulo"});
lfreneda/cepdb
api/v1/09931025.jsonp.js
JavaScript
cc0-1.0
142
jsonp({"cep":"26460240","logradouro":"Estrada da Col\u00f4nia","bairro":"Rio D'Ouro","cidade":"Japeri","uf":"RJ","estado":"Rio de Janeiro"});
lfreneda/cepdb
api/v1/26460240.jsonp.js
JavaScript
cc0-1.0
142
jsonp({"cep":"89228730","logradouro":"Rua Francisco Eduardo Bernardo","bairro":"Espinheiros","cidade":"Joinville","uf":"SC","estado":"Santa Catarina"});
lfreneda/cepdb
api/v1/89228730.jsonp.js
JavaScript
cc0-1.0
153
jsonp({"cep":"35700377","logradouro":"Rua Pedro Gabriel de Lima","bairro":"Jardim Arizona","cidade":"Sete Lagoas","uf":"MG","estado":"Minas Gerais"});
lfreneda/cepdb
api/v1/35700377.jsonp.js
JavaScript
cc0-1.0
151
jsonp({"cep":"88330323","logradouro":"Rua 3140","bairro":"Centro","cidade":"Balne\u00e1rio Cambori\u00fa","uf":"SC","estado":"Santa Catarina"});
lfreneda/cepdb
api/v1/88330323.jsonp.js
JavaScript
cc0-1.0
145
jsonp({"cep":"14056399","logradouro":"Rua Wanderley de Oliveira","bairro":"Planalto Verde","cidade":"Ribeir\u00e3o Preto","uf":"SP","estado":"S\u00e3o Paulo"});
lfreneda/cepdb
api/v1/14056399.jsonp.js
JavaScript
cc0-1.0
161
jsonp({"cep":"29167049","logradouro":"Rua Fortaleza II","bairro":"Alterosas","cidade":"Serra","uf":"ES","estado":"Esp\u00edrito Santo"});
lfreneda/cepdb
api/v1/29167049.jsonp.js
JavaScript
cc0-1.0
138
jsonp({"cep":"33900290","logradouro":"Rua Eunice Alves da Silva Ferreira","bairro":"S\u00e3o Jos\u00e9 (Justin\u00f3polis )","cidade":"Ribeir\u00e3o das Neves","uf":"MG","estado":"Minas Gerais"});
lfreneda/cepdb
api/v1/33900290.jsonp.js
JavaScript
cc0-1.0
197
jsonp({"cep":"53160350","logradouro":"Rua Dezoito de Fevereiro","bairro":"\u00c1guas Compridas","cidade":"Olinda","uf":"PE","estado":"Pernambuco"});
lfreneda/cepdb
api/v1/53160350.jsonp.js
JavaScript
cc0-1.0
149
jsonp({"cep":"38031070","logradouro":"Rua Vicente Pedro Ant\u00f4nio Hercos","bairro":"Parque Exposi\u00e7\u00e3o","cidade":"Uberaba","uf":"MG","estado":"Minas Gerais"});
lfreneda/cepdb
api/v1/38031070.jsonp.js
JavaScript
cc0-1.0
171
jsonp({"cep":"08500145","logradouro":"Rua Euclides da Cunha","bairro":"Vila Roman\u00f3polis","cidade":"Ferraz de Vasconcelos","uf":"SP","estado":"S\u00e3o Paulo"});
lfreneda/cepdb
api/v1/08500145.jsonp.js
JavaScript
cc0-1.0
166
jsonp({"cep":"13140850","logradouro":"Rua Antonio Meroni","bairro":"Parque da Figueira","cidade":"Paul\u00ednia","uf":"SP","estado":"S\u00e3o Paulo"});
lfreneda/cepdb
api/v1/13140850.jsonp.js
JavaScript
cc0-1.0
152
jsonp({"cep":"39803087","logradouro":"Rua Engenheiro Celso Murta","bairro":"Doutor Laerte Laender","cidade":"Te\u00f3filo Otoni","uf":"MG","estado":"Minas Gerais"});
lfreneda/cepdb
api/v1/39803087.jsonp.js
JavaScript
cc0-1.0
166
jsonp({"cep":"88047740","logradouro":"Rua Andr\u00e9 Osvaldo da Rosa","bairro":"Carianos","cidade":"Florian\u00f3polis","uf":"SC","estado":"Santa Catarina"});
lfreneda/cepdb
api/v1/88047740.jsonp.js
JavaScript
cc0-1.0
159
jsonp({"cep":"66640442","logradouro":"Bloco H","bairro":"Mangueir\u00e3o","cidade":"Bel\u00e9m","uf":"PA","estado":"Par\u00e1"});
lfreneda/cepdb
api/v1/66640442.jsonp.js
JavaScript
cc0-1.0
130
jsonp({"cep":"72543507","logradouro":"Quadra QR 313 Conjunto G","bairro":"Santa Maria","cidade":"Bras\u00edlia","uf":"DF","estado":"Distrito Federal"});
lfreneda/cepdb
api/v1/72543507.jsonp.js
JavaScript
cc0-1.0
153
jsonp({"cep":"40366310","logradouro":"Rua Baixa do Curuzu","bairro":"Curuzu","cidade":"Salvador","uf":"BA","estado":"Bahia"});
lfreneda/cepdb
api/v1/40366310.jsonp.js
JavaScript
cc0-1.0
127
jsonp({"cep":"07902100","logradouro":"Rua Tancredo Neves","bairro":"Jardim Eliza","cidade":"Francisco Morato","uf":"SP","estado":"S\u00e3o Paulo"});
lfreneda/cepdb
api/v1/07902100.jsonp.js
JavaScript
cc0-1.0
149
jsonp({"cep":"14165434","logradouro":"Rua Pedro Montenegro","bairro":"Jardim Santa Marta","cidade":"Sert\u00e3ozinho","uf":"SP","estado":"S\u00e3o Paulo"});
lfreneda/cepdb
api/v1/14165434.jsonp.js
JavaScript
cc0-1.0
157
jsonp({"cep":"17063560","logradouro":"Rua Ant\u00f4nio Alves de Souza","bairro":"Jardim V\u00e2nia Maria","cidade":"Bauru","uf":"SP","estado":"S\u00e3o Paulo"});
lfreneda/cepdb
api/v1/17063560.jsonp.js
JavaScript
cc0-1.0
162
jsonp({"cep":"63016015","logradouro":"Rua Doutor Floro Bartolomeu","bairro":"Juvencio Santana","cidade":"Juazeiro do Norte","uf":"CE","estado":"Cear\u00e1"});
lfreneda/cepdb
api/v1/63016015.jsonp.js
JavaScript
cc0-1.0
159
jsonp({"cep":"14404249","logradouro":"Rua Carlos Maranha","bairro":"Jardim Aeroporto III","cidade":"Franca","uf":"SP","estado":"S\u00e3o Paulo"});
lfreneda/cepdb
api/v1/14404249.jsonp.js
JavaScript
cc0-1.0
147
jsonp({"cep":"66025230","logradouro":"Travessa Padre Eut\u00edquio","bairro":"Batista Campos","cidade":"Bel\u00e9m","uf":"PA","estado":"Par\u00e1"});
lfreneda/cepdb
api/v1/66025230.jsonp.js
JavaScript
cc0-1.0
150
jsonp({"cep":"12324600","logradouro":"Rua Aparecida Ramos de Brito","bairro":"Jardim Nova Esperan\u00e7a","cidade":"Jacare\u00ed","uf":"SP","estado":"S\u00e3o Paulo"});
lfreneda/cepdb
api/v1/12324600.jsonp.js
JavaScript
cc0-1.0
169
jsonp({"cep":"68428000","cidade":"S\u00e3o Pedro de Viseu","uf":"PA","estado":"Par\u00e1"});
lfreneda/cepdb
api/v1/68428000.jsonp.js
JavaScript
cc0-1.0
93
with (DataBridgeService) { /** * The service that process and manage User related data */ var UserService = new Sgfd.Service({ metaName: 'UserService', /** * Get all the users from DB */ getAllUsers() { return fetchUsers() } }) }
santojon/santojon
services/userservice.js
JavaScript
cc0-1.0
313
jsonp({"cep":"25555382","logradouro":"Rua Doutor Gil Mota","bairro":"Jardim Meriti","cidade":"S\u00e3o Jo\u00e3o de Meriti","uf":"RJ","estado":"Rio de Janeiro"});
lfreneda/cepdb
api/v1/25555382.jsonp.js
JavaScript
cc0-1.0
163
jsonp({"cep":"40730128","logradouro":"Travessa S\u00e9rgio Olivaes","bairro":"Fazenda Coutos","cidade":"Salvador","uf":"BA","estado":"Bahia"});
lfreneda/cepdb
api/v1/40730128.jsonp.js
JavaScript
cc0-1.0
144
jsonp({"cep":"79645350","logradouro":"Rua Ot\u00e1vio Sigefredo Roriz","bairro":"S\u00e3o Jorge","cidade":"Tr\u00eas Lagoas","uf":"MS","estado":"Mato Grosso do Sul"});
lfreneda/cepdb
api/v1/79645350.jsonp.js
JavaScript
cc0-1.0
168
jsonp({"cep":"05881110","logradouro":"Rua Flam\u00ednio Ponzio","bairro":"Jardim S\u00e3o Bento Novo","cidade":"S\u00e3o Paulo","uf":"SP","estado":"S\u00e3o Paulo"});
lfreneda/cepdb
api/v1/05881110.jsonp.js
JavaScript
cc0-1.0
167
jsonp({"cep":"41940200","logradouro":"Conjunto Vila Cabrita","bairro":"Rio Vermelho","cidade":"Salvador","uf":"BA","estado":"Bahia"});
lfreneda/cepdb
api/v1/41940200.jsonp.js
JavaScript
cc0-1.0
135
jsonp({"cep":"15047010","logradouro":"Rua Carula Pereira de Lima","bairro":"Jardim das Oliveiras","cidade":"S\u00e3o Jos\u00e9 do Rio Preto","uf":"SP","estado":"S\u00e3o Paulo"});
lfreneda/cepdb
api/v1/15047010.jsonp.js
JavaScript
cc0-1.0
180
jsonp({"cep":"32677408","logradouro":"Rua Juncal-1","bairro":"Imbiru\u00e7u","cidade":"Betim","uf":"MG","estado":"Minas Gerais"});
lfreneda/cepdb
api/v1/32677408.jsonp.js
JavaScript
cc0-1.0
131
jsonp({"cep":"85301320","logradouro":"Rua Ezidio Bozza","bairro":"Centro","cidade":"Laranjeiras do Sul","uf":"PR","estado":"Paran\u00e1"});
lfreneda/cepdb
api/v1/85301320.jsonp.js
JavaScript
cc0-1.0
140
jsonp({"cep":"70313901","logradouro":"Quadra SHS Quadra 3","bairro":"Asa Sul","cidade":"Bras\u00edlia","uf":"DF","estado":"Distrito Federal"});
lfreneda/cepdb
api/v1/70313901.jsonp.js
JavaScript
cc0-1.0
144
jsonp({"cep":"98802410","logradouro":"Rua das Rosas","bairro":"Dornelles","cidade":"Santo \u00c2ngelo","uf":"RS","estado":"Rio Grande do Sul"});
lfreneda/cepdb
api/v1/98802410.jsonp.js
JavaScript
cc0-1.0
145
jsonp({"cep":"33115675","logradouro":"Rua El\u00f3i Ferreira da Silva","bairro":"Vila Beatriz (S\u00e3o Benedito)","cidade":"Santa Luzia","uf":"MG","estado":"Minas Gerais"});
lfreneda/cepdb
api/v1/33115675.jsonp.js
JavaScript
cc0-1.0
175
jsonp({"cep":"32110007","logradouro":"Beco Ambavip","bairro":"Ressaca","cidade":"Contagem","uf":"MG","estado":"Minas Gerais"});
lfreneda/cepdb
api/v1/32110007.jsonp.js
JavaScript
cc0-1.0
128
define(['app/database', 'jquery', 'bootstrap', 'parsley', 'app/select', 'app/forms', 'app/ready', 'async', 'app/lang', 'app/string', 'app/user', 'app/date'], function (db, $, bootstrap, parsley, select, forms, ready, async, lang, string, user, date) { var X = XLSX; var saveData; var correctUpload = false; // Function for saving all items in the dataset function createDatasetItems(data) { data = JSON.parse(data); var output = to_json(data); var sheetName = Object.keys(output)[0]; var dataset_items = []; $.each(output[sheetName], function (i, item) { var question = output[sheetName][i].question; var answer = output[sheetName][i].answer; var hint = (output[sheetName][i].hint === null) ? "" : output[sheetName][i].hint; dataset_items.push({"id": i, "text": question, "answer": answer, "hint": hint}); }); return JSON.stringify(dataset_items); } // Function for showing the user the system is loading function showLoading(onSuccess) { $("#loadFrame").children("h1").html(lang("open_busysaving")); $("#loadFrame").fadeIn(300, onSuccess); } function localisePage() { string.fillinTextClasses(); $("#datasetname").prop("placeholder", lang("placeholder_datasetname")); $("#datasetsubject").prop("title", lang("placeholder_subject")); $("#customsubject").prop("placeholder", lang("label_customsubject")); $("#buttonsave").prop("value", lang("open_buttonsave")); } function getUserDataFromDatabase() { $("span[data-replace]").each(function() { var user_info = $(this).data("replace"); var text = user.get(user_info); $(this).html(text); }); $("span[data-username]").html(user.get("user_firstname")+" "+user.get("user_lastname")); } function checkIfDatasetExists() { window.Parsley.addValidator('datasetName', { validateString: function(value, requirement) { var result = db.getQuery("getDatasetByName", [value]); return (result.length===0); }, messages: { en: lang("error_datasetnamenotunique") } }); } function handleCustomSubject() { window.Parsley.addValidator('subjectName', { validateString: function(value, requirement) { var result = db.getQuery("getSubjectByName", [value]); return result.length === 0; }, messages: { en: lang("error_subjectnamenotunique") } }); // Display the input for custom subject only if appropriate $("#datasetsubject").change(function() { var id = forms.getFormVal("#uploadForm", "select", "subject"); if (id === 0) { console.log("show"); $("#newsubject").attr("hidden", false); $("#customsubject").attr("required", ""); $("#customsubject").attr("data-parsley-subject-name", "1"); } else { console.log("hide"); $("#newsubject").attr("hidden", true); $("#customsubject").removeAttr("required"); $("#customsubject").removeAttr("data-parsley-subject-name"); } }); } function checkCorrectnessFile() { window.Parsley.addValidator('fileXlsx', { validateString: function(_value, maxSize, parsleyInstance) { return correctUpload; }, requirementType: 'integer', messages: { en: lang("error_unsupportedfiletype") } }); } function saveDatasetOnlineAndLocal(language, subject, data) { db.executeQuery("addDataset", data, false, true); db.lastInsertIdOnline('tbldatasets', 'dataset_id', function (id) { data.unshift(id); db.executeQuery("addDatasetAll", data, true, false); db.close(); window.location = "index.html?message=success_opendataset&language="+language+"&subject="+subject; }); } function evaluateInputOfForm() { var form = '#uploadForm'; forms.initialize(form); forms.onSuccess(form, function() { showLoading(function () { var form = '#uploadForm'; var name = forms.getFormVal(form, "input", "name"); var language = forms.getFormVal(form, "select", "language"); var subject = forms.getFormVal(form, "select", "subject"); var user_id = user.getCookie('user_id'); var currentdate = date.formatDatetime(new Date(), true); var dataset_items = createDatasetItems(saveData); if (db.online()) { saveDatasetOnlineAndLocal(language, subject, [user_id, name, language, subject, 0, 0, 1, currentdate, currentdate, dataset_items]); } else { db.executeQuery("addDatasetAll", [null, user_id, name, language, subject, 0, 0, 0, currentdate, currentdate, dataset_items], true, false); db.close(); window.location = "index.html?message=success_opendataset&language="+language+"&subject="+subject; } }); }); } function highlightUploadOnDrag() { $(document).on("dragenter", function() { $("#xlf").addClass("dragging"); }).on("drop", function() { $("#xlf").removeClass("dragging"); }); } function preventOpenOnDrag() { document.addEventListener('dragover',function(event) { if (event.target.id!="xlf") { event.preventDefault(); return false; } },false); } function initiateUploadBox() { var xlf = document.getElementById('xlf'); if (xlf.addEventListener) { xlf.addEventListener('change', handleFile, false); } } ready.on(function() { localisePage(); getUserDataFromDatabase(); checkIfDatasetExists(); handleCustomSubject(); checkCorrectnessFile(); evaluateInputOfForm(); // Initiate select boxes select.initiate("languages", ".selectLanguage"); select.initiate("subjects", ".selectSubject"); highlightUploadOnDrag(); preventOpenOnDrag(); document.addEventListener('drop',function(event){ if (event.target.id!="xlf") { event.preventDefault(); return false; } },false); }); /* Scripts for reading and processing the XLS files. * See https://github.com/SheetJS/js-xlsx for reference */ var XW = { /* worker message */ msg : 'xlsx', /* worker scripts */ rABS : './node_modules/xlsx/xlsxworker2.js', }; var rABS = typeof FileReader !== "undefined" && typeof FileReader.prototype !== "undefined" && typeof FileReader.prototype.readAsBinaryString !== "undefined"; function ab2str(data) { var o = "", l = 0, w = 10240; for (; l < data.byteLength / w; ++l) o += String.fromCharCode.apply(null, new Uint16Array(data.slice(l * w, l * w + w))); o += String.fromCharCode.apply(null, new Uint16Array(data.slice(l * w))); return o; } function s2ab(s) { var b = new ArrayBuffer(s.length * 2), v = new Uint16Array(b); for (var i = 0; i != s.length; ++i) { v[i] = s.charCodeAt(i); } return [v, b]; } function xw_xfer(data) { var worker = new Worker(XW.rABS); worker.onmessage = function (e) { switch (e.data.t) { case 'ready': correctUpload = true; break; case 'e': correctUpload = false; console.error(e.data.d); break; default: saveData = ab2str(e.data).replace(/\n/g, "\\n").replace(/\r/g, "\\r"); break; } }; var val = s2ab(data); worker.postMessage(val[1], [val[1]]); } function to_json(workbook) { var result = {}; workbook.SheetNames.forEach(function (sheetName) { var roa = X.utils.sheet_to_row_object_array(workbook.Sheets[sheetName]); if (roa.length > 0) { result[sheetName] = roa; } }); return result; } function handleFile(e) { var files = e.target.files; readFile(files, e); } function readFile(files, e) { console.log('readfile'); var f = files[0]; var reader = new FileReader(); var name = f.name; reader.onload = function (e) { if (typeof console !== 'undefined') { console.log("onload", new Date(), true, true); } var data = e.target.result; xw_xfer(data); }; reader.readAsBinaryString(f); } initiateUploadBox(); });
RUGSoftEng/Team-5
app/open.js
JavaScript
cc0-1.0
7,631
jsonp({"cep":"12237150","logradouro":"Rua Oros","bairro":"Palmeiras de S\u00e3o Jos\u00e9","cidade":"S\u00e3o Jos\u00e9 dos Campos","uf":"SP","estado":"S\u00e3o Paulo"});
lfreneda/cepdb
api/v1/12237150.jsonp.js
JavaScript
cc0-1.0
171
jsonp({"cep":"03711002","logradouro":"Viela Arnaldo Ferreira da Silva","bairro":"Canga\u00edba","cidade":"S\u00e3o Paulo","uf":"SP","estado":"S\u00e3o Paulo"});
lfreneda/cepdb
api/v1/03711002.jsonp.js
JavaScript
cc0-1.0
161
jsonp({"cep":"81250540","logradouro":"Rua Bras\u00edlia Alves de Faria de Lara","bairro":"Cidade Industrial","cidade":"Curitiba","uf":"PR","estado":"Paran\u00e1"});
lfreneda/cepdb
api/v1/81250540.jsonp.js
JavaScript
cc0-1.0
165
jsonp({"cep":"18017284","logradouro":"Travessa do Horto","bairro":"Jardim Novo Eldorado","cidade":"Sorocaba","uf":"SP","estado":"S\u00e3o Paulo"});
lfreneda/cepdb
api/v1/18017284.jsonp.js
JavaScript
cc0-1.0
148
jsonp({"cep":"80240110","logradouro":"Rua Bento Viana","bairro":"\u00c1gua Verde","cidade":"Curitiba","uf":"PR","estado":"Paran\u00e1"});
lfreneda/cepdb
api/v1/80240110.jsonp.js
JavaScript
cc0-1.0
138
jsonp({"cep":"60326010","logradouro":"Rua Fernando Weyne","bairro":"Monte Castelo","cidade":"Fortaleza","uf":"CE","estado":"Cear\u00e1"});
lfreneda/cepdb
api/v1/60326010.jsonp.js
JavaScript
cc0-1.0
139
jsonp({"cep":"41315080","logradouro":"Rua das Ursulinas","bairro":"Dom Avelar","cidade":"Salvador","uf":"BA","estado":"Bahia"});
lfreneda/cepdb
api/v1/41315080.jsonp.js
JavaScript
cc0-1.0
129
jsonp({"cep":"93520670","logradouro":"Pra\u00e7a Quinze de Novembro","bairro":"Guarani","cidade":"Novo Hamburgo","uf":"RS","estado":"Rio Grande do Sul"});
lfreneda/cepdb
api/v1/93520670.jsonp.js
JavaScript
cc0-1.0
155
jsonp({"cep":"66670335","logradouro":"Travessa SN 10","bairro":"Coqueiro","cidade":"Bel\u00e9m","uf":"PA","estado":"Par\u00e1"});
lfreneda/cepdb
api/v1/66670335.jsonp.js
JavaScript
cc0-1.0
130
jsonp({"cep":"77826568","logradouro":"Rua 5","bairro":"Setor Coimbra","cidade":"Aragua\u00edna","uf":"TO","estado":"Tocantins"});
lfreneda/cepdb
api/v1/77826568.jsonp.js
JavaScript
cc0-1.0
130
jsonp({"cep":"55022110","logradouro":"Rua Eug\u00eanio Jo\u00e3o de Amorim","bairro":"Rendeiras","cidade":"Caruaru","uf":"PE","estado":"Pernambuco"});
lfreneda/cepdb
api/v1/55022110.jsonp.js
JavaScript
cc0-1.0
151
angular.module('learnDigest', []) .controller('TestController', TestController) .controller('SubController', SubController) .controller('ClickController', ClickController) .controller('MethodController', MethodController); function TestController($scope) { var vm = this; vm.name = 'Halk'; $scope.controllerName = 'TestController'; this.getName = function functionName() { return vm.name; }; } function SubController($scope) { $scope.controllerName = 'SubController'; } function MethodController($scope) { $scope.controllerName = 'MethodController'; } function ClickController($scope) { $scope.controllerName = 'ClickController'; }
bi0morph/angular-examples
$digest/js/script.js
JavaScript
cc0-1.0
647
jsonp({"cep":"13232130","logradouro":"Rua Rio Paranapanema","bairro":"Jardim Santo Ant\u00f4nio II","cidade":"Campo Limpo Paulista","uf":"SP","estado":"S\u00e3o Paulo"});
lfreneda/cepdb
api/v1/13232130.jsonp.js
JavaScript
cc0-1.0
171
jsonp({"cep":"21535530","logradouro":"Rua Variante D","bairro":"Pavuna","cidade":"Rio de Janeiro","uf":"RJ","estado":"Rio de Janeiro"});
lfreneda/cepdb
api/v1/21535530.jsonp.js
JavaScript
cc0-1.0
137
jsonp({"cep":"85851445","logradouro":"Rua Arquiteto D\u00e9cio Luiz Cardoso","bairro":"Centro","cidade":"Foz do Igua\u00e7u","uf":"PR","estado":"Paran\u00e1"});
lfreneda/cepdb
api/v1/85851445.jsonp.js
JavaScript
cc0-1.0
161
jsonp({"cep":"39402521","logradouro":"Rua NM","bairro":"Delfino Magalh\u00e3es","cidade":"Montes Claros","uf":"MG","estado":"Minas Gerais"});
lfreneda/cepdb
api/v1/39402521.jsonp.js
JavaScript
cc0-1.0
142
jsonp({"cep":"85861030","logradouro":"Avenida Parati","bairro":"Vila Residencial A","cidade":"Foz do Igua\u00e7u","uf":"PR","estado":"Paran\u00e1"});
lfreneda/cepdb
api/v1/85861030.jsonp.js
JavaScript
cc0-1.0
150
import React from 'react'; class Header extends React.Component { render() { return ( <div className="header"> <title>Magica @ Nya</title> <h1>Magica @ Nya</h1> </div> ); } } export default Header;
magicae/magicae.github.io
app/scripts/components/header.js
JavaScript
cc0-1.0
240
jsonp({"cep":"04386100","logradouro":"Rua Jo\u00e3o de Lana","bairro":"Jardim Itacolomi","cidade":"S\u00e3o Paulo","uf":"SP","estado":"S\u00e3o Paulo"});
lfreneda/cepdb
api/v1/04386100.jsonp.js
JavaScript
cc0-1.0
154
jsonp({"cep":"58030000","logradouro":"Avenida Presidente Epit\u00e1cio Pessoa","bairro":"Estados","cidade":"Jo\u00e3o Pessoa","uf":"PB","estado":"Para\u00edba"});
lfreneda/cepdb
api/v1/58030000.jsonp.js
JavaScript
cc0-1.0
163
jsonp({"cep":"24860016","logradouro":"Rua Alto Rodrigues de Freitas","bairro":"Novo Horizonte (Manilha)","cidade":"Itabora\u00ed","uf":"RJ","estado":"Rio de Janeiro"});
lfreneda/cepdb
api/v1/24860016.jsonp.js
JavaScript
cc0-1.0
169
jsonp({"cep":"07091170","logradouro":"Rua Coronel Querubin Franco","bairro":"Jardim Bebedouro","cidade":"Guarulhos","uf":"SP","estado":"S\u00e3o Paulo"});
lfreneda/cepdb
api/v1/07091170.jsonp.js
JavaScript
cc0-1.0
155
jsonp({"cep":"08598351","logradouro":"Rua Carvalho","bairro":"Jardim Odete","cidade":"Itaquaquecetuba","uf":"SP","estado":"S\u00e3o Paulo"});
lfreneda/cepdb
api/v1/08598351.jsonp.js
JavaScript
cc0-1.0
142
jsonp({"cep":"07846000","logradouro":"Avenida S\u00e3o Paulo","bairro":"Vila Bela","cidade":"Franco da Rocha","uf":"SP","estado":"S\u00e3o Paulo"});
lfreneda/cepdb
api/v1/07846000.jsonp.js
JavaScript
cc0-1.0
149
jsonp({"cep":"13330100","logradouro":"Rua Nove de Julho","bairro":"Centro","cidade":"Indaiatuba","uf":"SP","estado":"S\u00e3o Paulo"});
lfreneda/cepdb
api/v1/13330100.jsonp.js
JavaScript
cc0-1.0
136
jsonp({"cep":"79041610","logradouro":"Rua S\u00edlvio Romero","bairro":"Jardim S\u00e3o Louren\u00e7o","cidade":"Campo Grande","uf":"MS","estado":"Mato Grosso do Sul"});
lfreneda/cepdb
api/v1/79041610.jsonp.js
JavaScript
cc0-1.0
170
jsonp({"cep":"01012030","logradouro":"Largo do Caf\u00e9","bairro":"Centro","cidade":"S\u00e3o Paulo","uf":"SP","estado":"S\u00e3o Paulo"});
lfreneda/cepdb
api/v1/01012030.jsonp.js
JavaScript
cc0-1.0
141
jsonp({"cep":"74280365","logradouro":"Avenida C 171","bairro":"Setor Nova Sui\u00e7a","cidade":"Goi\u00e2nia","uf":"GO","estado":"Goi\u00e1s"});
lfreneda/cepdb
api/v1/74280365.jsonp.js
JavaScript
cc0-1.0
145
var https = require("https"); var EmailReplyParser = require("emailreplyparser").EmailReplyParser; var MandrillGateway = function (mandrillKey, defaultFromEmail, defaultFromName) { var self = this; self.handleInboundEmail = function (req, res, messageStore) { var events = req.body.mandrill_events || []; if (typeof events === "string") { events = JSON.parse(events); } events.forEach(function (event) { var newMessage = { received: new Date(), account: event.msg.email, fromEmail: event.msg.from_email, fromName: event.msg.from_name, toEmail: event.msg.to, subject: event.msg.subject, text: EmailReplyParser.parse_reply(event.msg.text || ""), status: 'Pending', // so we can reply in context later _contextMessageId: event.msg.headers['Message-Id'] }; console.error("new event: \n"+ JSON.stringify(event)); console.error("new message: \n"+ JSON.stringify(newMessage)); messageStore.saveMessage(newMessage); }); return res.send(204); }; self.replyToSender = function(message, body, senderEmail, subject) { subject = subject || (message.subject && message.subject.indexOf("Re:") === -1) ? ("Re: "+ message.subject) : message.subject; var payload = { key : mandrillKey, message: { text: "This is an automated response to your message to "+ message.account + "\n\n" + body, from_email: senderEmail || defaultFromEmail, from_name: defaultFromName, subject: subject, to: [{ email: message.fromEmail, name: message.fromName, type: "to" }], headers: { 'In-Reply-To': message._contextMessageId } } }; var options = { hostname: 'mandrillapp.com', path: '/api/1.0/messages/send.json', method: 'POST', headers: { 'content-type': 'application/json' } }; console.log("message: \n"+ JSON.stringify(message)); console.log("options: \n"+ JSON.stringify(options)); console.log("payload: \n"+ JSON.stringify(payload)); var req = https.request(options, function(res) { res.on('data', function(d) { process.stdout.write(d); }); }); req.write(JSON.stringify(payload)); req.end(); req.on('error', function(e) { console.error(e); }); }; return self; } var exports = module.exports = MandrillGateway;
abstratt/ebui
mandrill-gateway.js
JavaScript
epl-1.0
2,829
// Compiled by ClojureScript 0.0-2411 goog.provide('clojure.browser.event'); goog.require('cljs.core'); goog.require('goog.events.EventType'); goog.require('goog.events.EventTarget'); goog.require('goog.events'); goog.require('goog.events'); clojure.browser.event.IEventType = (function (){var obj5183 = {}; return obj5183; })(); clojure.browser.event.event_types = (function event_types(this$){ if((function (){var and__3679__auto__ = this$; if(and__3679__auto__){ return this$.clojure$browser$event$IEventType$event_types$arity$1; } else { return and__3679__auto__; } })()){ return this$.clojure$browser$event$IEventType$event_types$arity$1(this$); } else { var x__4330__auto__ = (((this$ == null))?null:this$); return (function (){var or__3691__auto__ = (clojure.browser.event.event_types[goog.typeOf(x__4330__auto__)]); if(or__3691__auto__){ return or__3691__auto__; } else { var or__3691__auto____$1 = (clojure.browser.event.event_types["_"]); if(or__3691__auto____$1){ return or__3691__auto____$1; } else { throw cljs.core.missing_protocol.call(null,"IEventType.event-types",this$); } } })().call(null,this$); } }); goog.events.EventTarget.prototype.clojure$browser$event$IEventType$ = true; goog.events.EventTarget.prototype.clojure$browser$event$IEventType$event_types$arity$1 = (function (this$){ var this$__$1 = this; return cljs.core.into.call(null,cljs.core.PersistentArrayMap.EMPTY,cljs.core.map.call(null,((function (this$__$1){ return (function (p__5184){ var vec__5185 = p__5184; var k = cljs.core.nth.call(null,vec__5185,(0),null); var v = cljs.core.nth.call(null,vec__5185,(1),null); return new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [cljs.core.keyword.call(null,k.toLowerCase()),v], null); });})(this$__$1)) ,cljs.core.merge.call(null,cljs.core.js__GT_clj.call(null,goog.events.EventType)))); }); if(typeof Element !== 'undefined'){ Element.prototype.clojure$browser$event$IEventType$ = true; Element.prototype.clojure$browser$event$IEventType$event_types$arity$1 = (function (this$){ var this$__$1 = this; return cljs.core.into.call(null,cljs.core.PersistentArrayMap.EMPTY,cljs.core.map.call(null,((function (this$__$1){ return (function (p__5186){ var vec__5187 = p__5186; var k = cljs.core.nth.call(null,vec__5187,(0),null); var v = cljs.core.nth.call(null,vec__5187,(1),null); return new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [cljs.core.keyword.call(null,k.toLowerCase()),v], null); });})(this$__$1)) ,cljs.core.merge.call(null,cljs.core.js__GT_clj.call(null,goog.events.EventType)))); }); } else { } clojure.browser.event.listen = (function() { var listen = null; var listen__3 = (function (src,type,fn){ return listen.call(null,src,type,fn,false); }); var listen__4 = (function (src,type,fn,capture_QMARK_){ return goog.events.listen(src,cljs.core.get.call(null,clojure.browser.event.event_types.call(null,src),type,type),fn,capture_QMARK_); }); listen = function(src,type,fn,capture_QMARK_){ switch(arguments.length){ case 3: return listen__3.call(this,src,type,fn); case 4: return listen__4.call(this,src,type,fn,capture_QMARK_); } throw(new Error('Invalid arity: ' + arguments.length)); }; listen.cljs$core$IFn$_invoke$arity$3 = listen__3; listen.cljs$core$IFn$_invoke$arity$4 = listen__4; return listen; })() ; clojure.browser.event.listen_once = (function() { var listen_once = null; var listen_once__3 = (function (src,type,fn){ return listen_once.call(null,src,type,fn,false); }); var listen_once__4 = (function (src,type,fn,capture_QMARK_){ return goog.events.listenOnce(src,cljs.core.get.call(null,clojure.browser.event.event_types.call(null,src),type,type),fn,capture_QMARK_); }); listen_once = function(src,type,fn,capture_QMARK_){ switch(arguments.length){ case 3: return listen_once__3.call(this,src,type,fn); case 4: return listen_once__4.call(this,src,type,fn,capture_QMARK_); } throw(new Error('Invalid arity: ' + arguments.length)); }; listen_once.cljs$core$IFn$_invoke$arity$3 = listen_once__3; listen_once.cljs$core$IFn$_invoke$arity$4 = listen_once__4; return listen_once; })() ; clojure.browser.event.unlisten = (function() { var unlisten = null; var unlisten__3 = (function (src,type,fn){ return unlisten.call(null,src,type,fn,false); }); var unlisten__4 = (function (src,type,fn,capture_QMARK_){ return goog.events.unlisten(src,cljs.core.get.call(null,clojure.browser.event.event_types.call(null,src),type,type),fn,capture_QMARK_); }); unlisten = function(src,type,fn,capture_QMARK_){ switch(arguments.length){ case 3: return unlisten__3.call(this,src,type,fn); case 4: return unlisten__4.call(this,src,type,fn,capture_QMARK_); } throw(new Error('Invalid arity: ' + arguments.length)); }; unlisten.cljs$core$IFn$_invoke$arity$3 = unlisten__3; unlisten.cljs$core$IFn$_invoke$arity$4 = unlisten__4; return unlisten; })() ; clojure.browser.event.unlisten_by_key = (function unlisten_by_key(key){ return goog.events.unlistenByKey(key); }); clojure.browser.event.dispatch_event = (function dispatch_event(src,event){ return goog.events.dispatchEvent(src,event); }); clojure.browser.event.expose = (function expose(e){ return goog.events.expose(e); }); clojure.browser.event.fire_listeners = (function fire_listeners(obj,type,capture,event){ return null; }); clojure.browser.event.total_listener_count = (function total_listener_count(){ return goog.events.getTotalListenerCount(); }); clojure.browser.event.get_listener = (function get_listener(src,type,listener,opt_capt,opt_handler){ return null; }); clojure.browser.event.all_listeners = (function all_listeners(obj,type,capture){ return null; }); clojure.browser.event.unique_event_id = (function unique_event_id(event_type){ return null; }); clojure.browser.event.has_listener = (function has_listener(obj,opt_type,opt_capture){ return null; }); clojure.browser.event.remove_all = (function remove_all(opt_obj,opt_type,opt_capt){ return null; });
tjames221188/modern-cljs
out/clojure/browser/event.js
JavaScript
epl-1.0
5,929
/** * pt_BR translation * By Ujvari * 2009-09-21 * */ //if(Ext.ux.SimplePagingToolbar){ //Ext.apply(Ext.ux.SimplePagingToolbar.prototype, { // beforePageText: "P&aacute;gina", // afterPageText: "de {0}", // firstText: "Primeira P&aacute;gina", // prevText: "P&aacute;gina Anterior", // nextText: "Pr&oacute;xima P&aacute;gina", // lastText: "&Uacute;ltima P&aacute;gina", // displayMsg: "Mostrando {0} - {1} de {2}", // emptyMsg: 'Sem dados a serem exibidos' //}); //} Ext.apply(F.ajax, { errorMsg: "Mensagem de Erro: {0} ( {1} )" }); Ext.apply(F.util, { alertTitle: "Alerta", confirmTitle: "Confirma&ccedil;&atilde;o", formAlertMsg: "Por favor, insira um valor para o campo {0}!", formAlertTitle: "Formul&aacute;rio Inv&aacute;lido", loading: "Carregando..." }); Ext.apply(F.wnd, { closeButtonTooltip: "Close this window", formModifiedConfirmTitle: "Fechamento Confirmado", formModifiedConfirmMsg: "O formul&aacute;rio atual foi modificado.<br/><br/>Cancelar Altera&ccedil;&otilde;es?" });
proson/project
FineUI.Examples/extjs_builder/js/lang/f-lang-pt_BR.js
JavaScript
epl-1.0
1,058
define([ 'pgui.editors/plain', 'signature_pad' ], function (PlainEditor, Signature) { return PlainEditor.extend({ init: function (rootElement, readyCallback) { this._super(rootElement, readyCallback); var self = this; this._history = []; var initialValue = ''; var $signatureContainer = rootElement.closest('div'); var canvas = $signatureContainer.find('canvas').first().get(0); this.formatForSaving = rootElement.data('format-for-saving'); this.$clearBtn = $signatureContainer.find("[data-action=clear]"); this.$undoBtn = $signatureContainer.find("[data-action=undo]"); var penColor = rootElement.data('pen-color') ? rootElement.data('pen-color') : 'black'; var backgroundColor = rootElement.data('background-color') ? rootElement.data('background-color') : 'transparent'; this.signaturePad = new Signature(canvas, { penColor: penColor, backgroundColor: backgroundColor, onEnd: function() { self.rootElement.val(self.toDataURL()); self._history.push(self.getValue()); self.$undoBtn.prop('disabled', false); } }); if (this.getValue()) { this.signaturePad.fromDataURL(this.getValue()); initialValue = this.getValue(); } this._enableControls(this.getEnabled() && !this.getReadonly()); this.$clearBtn.click(function() { self.signaturePad.clear(); self.rootElement.val(''); self._history = []; initialValue = ''; self.$undoBtn.prop('disabled', true); return false; }); this.$undoBtn.click(function() { self._history.pop(); if (self._history.length == 0) { self.setValue(initialValue); $(this).prop('disabled', true); } else { self.setValue(self._history[self._history.length - 1]); } return false; }); }, setValue: function(value) { this.rootElement.val(value); this.signaturePad.clear(); this.signaturePad.fromDataURL(value); return this; }, toDataURL: function() { if (this.formatForSaving == 'svg') { return this.signaturePad.toDataURL("image/svg+xml"); } else if (this.formatForSaving == 'jpg') { return this.signaturePad.toDataURL("image/jpeg") } else { return this.signaturePad.toDataURL(); } }, setEnabled: function(value) { this._super(value); this._enableControls(value && !this.getReadonly()); return this; }, setReadonly: function(value) { this._super(value); this._enableControls(!value && this.getEnabled()); return this; }, _enableControls: function(value) { if (value) { this.signaturePad.on(); this.$clearBtn.prop('disabled', false); if (this._history.length > 0) { this.$undoBtn.prop('disabled', false); } } else { this.signaturePad.off(); this.$clearBtn.prop('disabled', true); this.$undoBtn.prop('disabled', true); } } }); });
lobbywatch/lobbywatch
public_html/bearbeitung/components/js/pgui.editors/signature.js
JavaScript
gpl-2.0
3,684
/************************************************************************************************** * Archivo: ListadoController.js * ------------------------------------------------------------------------------------------------ * Version: 1.0 * Descripcion: * Modificaciones: * - * * Nota: Registrar en este encabezado todas las modificaciones hechas al archivo. **************************************************************************************************/ Ext.define ('Sistema.view.Produccion.LineaDeProduccion.ListadoController', { extend: 'Ext.app.ViewController', alias: 'controller.prod-ldp-ListadoController', requires:[ 'Sistema.view.Produccion.LineaDeProduccion.ListadoGrillaStore' ], // // Asignacion de EventHandlers para los controles de la vista. // init: function () { ListadoControllerBase2.InyectarDependencia (this, 'Produccion:LineaDeProduccion'); this.params = { formularioController: 'Server/Sysgran/Aplicacion/Modulos/Produccion/LineaDeProduccion/FormularioController.php', nuevaEntidad : 'Sistema.view.Produccion.LineaDeProduccion.Formulario', editarEntidad : 'Sistema.view.Produccion.LineaDeProduccion.Formulario', storeGrilla : 'Sistema.view.Produccion.LineaDeProduccion.ListadoGrillaStore', xtypeListado : 'prod-ldp-Listado', ventanaMaximizable : false, ventanaMaximized : false, ventanaModal : false, verColEditar : true, verColBorrar : true, anchoVentana : 800, altoVentana : 500 }; this.control({ "grid": { celldblclick: this.onListadoGrillaCellDblClick }, "button[name='btnBuscar']": { click: this.onBtnBuscarClick }, "button[name='btnLimpiarFiltros']": { click: this.onBtnLimpiarFiltrosClick }, "button[name='btnNuevo']": { click: this.onBtnNuevoClick }, "button[name='btnRecargarListado']": { click: this.onBtnRecargarListadoClick }, "button[name='btnAceptar']": { click: this.onBtnAceptarClick }, "button[name='btnCancelar']": { click: this.onBtnCancelarClick }, "prod-ldp-Listado": { render: this.onRender } }); }, SetupFiltros: function () { this.AgregarFiltro (new FiltroTexto ('codigo', this, 'cbCodigo', 'tbCodigo', 'tcodigo', 'codigo')); this.AgregarFiltro (new FiltroTexto ('descripcion', this, 'cbDescripcion', 'tbDescripcion', 'tdesc', 'desc')); }, GetOnNuevoParamsEntrada: function (params) { return ManejadorDeVentanas.ReqFormularioWS (null); }, GetOnEditarParamsEntrada: function (item, params) { return ManejadorDeVentanas.ReqFormularioWS (item.get ('id')); } });
marcelinoar/FrameworkWeb
src/base/cliente/app/view/Produccion/LineaDeProduccion/ListadoController.js
JavaScript
gpl-2.0
2,680
jQuery(document).ready(function($){function e(){$("body").addClass("overlay-active"),$("#nona-overlay-wrap").fadeIn()}jQuery(document).bind("gform_confirmation_loaded",function(e,o){1==o&&($("#nona-overlay-wrap").delay(5e3).fadeOut(300),$("body").removeClass("overlay-active"),cookie.set("ftds","verified",{expires:180,domain:document.location.hostname,path:"/",secure:!1}))}),cookie.get("ftds")||e()});
Nona-Creative/nona-site-gate
assets/js/frontgate.min.js
JavaScript
gpl-2.0
403
"use strict"; (function ($) { jQuery(document).ready(function () { // change navbar style on scroll // ================================================== // When the user scrolls down 80px from the top of the document, resize the navbar's padding and the logo's font size // $.onscroll = function() {scrollFunction()}; $(document).scroll(function () { if ($(document).scrollTop() > 40) { $('#top-navbar').removeClass('initial-navbar'); $('#top-navbar').addClass('final-navbar shadow'); $('#navbar-toggler').removeClass('navbar-dark'); $('#navbar-toggler').addClass('navbar-light'); // get the main logo from hidden img tag let mainLogo = document.getElementById("main-logo").getAttribute("src"); $('#logo').attr("src", mainLogo); } else { $('#top-navbar').removeClass('final-navbar shadow'); $('#top-navbar').addClass('initial-navbar'); $('#navbar-toggler').removeClass('navbar-light'); $('#navbar-toggler').addClass('navbar-dark'); // get the inverted logo from hidden img tag let invertedLogo = document.getElementById("inverted-logo").getAttribute("src"); $('#logo').attr("src", invertedLogo); } }); // Creates a click handler to collapse the navigation when // anchors in the mobile nav pop up are clicked var navMain = $(".navbar-collapse"); if (navMain) { navMain.on("click", "a", null, function (e) { $('.navbar-collapse').collapse('hide'); }); } }); })(jQuery);
SrNetoChan/srnetochan.github.io
js/navbar.js
JavaScript
gpl-2.0
1,576
USETEXTLINKS = 1 STARTALLOPEN = 0 WRAPTEXT = 1 PRESERVESTATE = 0 HIGHLIGHT = 1 ICONPATH = 'file:////Users/eric/github/popgenDB/sims_for_structure_paper/2PopDNAnorec_0.5_1000/' //change if the gif's folder is a subfolder, for example: 'images/' foldersTree = gFld("<i>ARLEQUIN RESULTS (2PopDNAnorec_1_723.arp)</i>", "") insDoc(foldersTree, gLnk("R", "Arlequin log file", "Arlequin_log.txt")) aux1 = insFld(foldersTree, gFld("Run of 31/07/18 at 17:02:28", "2PopDNAnorec_1_723.xml#31_07_18at17_02_28")) insDoc(aux1, gLnk("R", "Settings", "2PopDNAnorec_1_723.xml#31_07_18at17_02_28_run_information")) aux2 = insFld(aux1, gFld("Genetic structure (samp=pop)", "2PopDNAnorec_1_723.xml#31_07_18at17_02_28_pop_gen_struct")) insDoc(aux2, gLnk("R", "AMOVA", "2PopDNAnorec_1_723.xml#31_07_18at17_02_28_pop_amova")) insDoc(aux2, gLnk("R", "Pairwise distances", "2PopDNAnorec_1_723.xml#31_07_18at17_02_28_pop_pairw_diff"))
DIPnet/popgenDB
sims_for_structure_paper/2PopDNAnorec_0.5_1000/2PopDNAnorec_1_723.res/2PopDNAnorec_1_723.js
JavaScript
gpl-2.0
922
module.exports = { build: { src: 'images/sprites/source/**/*.*', dest: 'images/sprites/sprite.png', destCss: 'scss/utilities/sprites/_sprite.scss', imgPath: '../images/sprites/sprite.png', cssTemplate: 'scss/utilities/sprites.styl.mustache', cssVarMap: function (sprite) { sprite.name = 'sprite__' + sprite.name; }, padding: 20 }, buildRetina: { src: 'images/sprites/source-2x/**/*.*', dest: 'images/sprites/sprite-2x.png', destCss: 'scss/utilities/sprites/_sprite-2x.scss', imgPath: '../images/sprites/sprite-2x.png', cssTemplate: 'scss/utilities/sprites.styl.mustache', cssVarMap: function (sprite) { sprite.name = 'sprite-2x__' + sprite.name; }, padding: 40 } };
seafoam6/magento-boilerplate
skin/frontend/magentoboilerplate/default/grunt/sprite.js
JavaScript
gpl-2.0
833
function closeBattle(event){ territorysSelected[0]=null; territorysSelected[1]=null; battle.style.display="none"; //chat.style.opacity=1; } function openBattle(){ battle.style.display="block"; $('#Ocultar').off('click'); $('#next').off('click'); $('#Stop').off('click'); Ocultar.onclick =closeBattle; if(!isMyTurn()){ next.style.display="none"; Stop.style.display="none"; }else{ if( graph.node(territorysSelected[0]).numSoldier>1){ next.style.display="flex"; next.onclick =nextRound; }else{ next.style.display="none"; } Stop.style.display="block"; Stop.onclick =changeBattle; } } function nextRound(){ socket.emit("doMove", {nick: nick, idMatch: idMatch, idTerritory1: territorysSelected[0],idTerritory2: territorysSelected[1] } ); } function changeBattle(){ socket.emit("doMove", {nick: nick, idMatch: idMatch, idTerritory1: null,idTerritory2: null }); battle.style.display="none"; //stage = stage.nextStage(); }
jorenver/DRisk
app/public/js/battle.js
JavaScript
gpl-2.0
966
// variable used only locally to this set of functions var selectedMapInList=0; var selMaps; // Menu Svg Object Basic Functions function instantiateRWAdminMenu(){ mapMenu.removeChilds(); instantiateMapGroupAdminMode(); nodeMenu.removeChilds(); instantiateNodeGroup(); refreshMenu.removeChilds(); instantiateRefreshGroupAdminMode(); mapMenu.activate(); nodeMenu.activate(); refreshMenu.activate(); } function instantiateRWNormalMenu(){ mapMenu.removeChilds(); instantiateMapGroupNormalMode(); viewMenu.removeChilds(); instantiateViewGroup(); refreshMenu.removeChilds(); instantiateRefreshGroupNormalMode(); mapMenu.activate(); viewMenu.activate(); refreshMenu.activate(); } function instantiateROMenu(){ mapMenu.removeChilds(); instantiateMapGroup(); viewMenu.removeChilds(); instantiateViewGroup(); refreshMenu.removeChilds(); instantiateRefreshGroupNormalMode(); mapMenu.activate(); viewMenu.activate(); refreshMenu.activate(); } function enableMenu(){ if(isUserAdmin){ if (isAdminMode) { instantiateRWAdminMenu(); } else { instantiateRWNormalMenu(); } }else{ instantiateROMenu(); } } function disableMenu(){ mapMenu.deactivate(); nodeMenu.deactivate(); viewMenu.deactivate(); refreshMenu.deactivate(); } function resetWorkPanel(menuName, menuOpening){ windowsClean(); myMapApp.disableTooltips(); if (menuOpening) { hideMapInfo(); hideHistory(); } else { showMapInfo(); showHistory(); } if(mapMenuId != menuName) mapMenu.close(); if(nodeMenuId != menuName) nodeMenu.close(); if(viewMenuId != menuName) viewMenu.close(); if(refreshMenuId != menuName) refreshMenu.close(); } function closeAllMenu(){ mapMenu.close(); nodeMenu.close(); viewMenu.close(); refreshMenu.close(); } function instantiateMapGroupAdminMode() { // ***ADMIN MODE MAP MENU *** var itemId="SetBG"; var itemEl1id = "SetBGColor"; var itemEl2id = "SetBGImage"; var subitems = new Array(itemEl1id,itemEl2id); var id = "新建"; mapMenu.addElement(id, id, menuDeltaX,menuDeltaY,menuWidth,menuHeight, newMapSetUp, subitems); id="打开"; mapMenu.addElement(id, id, menuDeltaX,2*menuDeltaY,menuWidth,menuHeight, addMapsList, subitems); id="关闭"; mapMenu.addElement(id, id, menuDeltaX,3*menuDeltaY,menuWidth,menuHeight, closeSetUp, subitems); id="重命名"; mapMenu.addElement(id, id, menuDeltaX,4*menuDeltaY,menuWidth,menuHeight, addRenameMapBox, subitems); id="删除"; mapMenu.addElement(id, id, menuDeltaX,5*menuDeltaY,menuWidth,menuHeight, deleteMapSetUp, subitems); id="保存"; mapMenu.addElement(id, id, menuDeltaX,6*menuDeltaY,menuWidth,menuHeight, saveMapSetUp, subitems); id="清除"; mapMenu.addElement(id, id, menuDeltaX,7*menuDeltaY,menuWidth,menuHeight, clearMapSetUp, subitems); mapMenu.addItem(itemId, "背景",menuDeltaX,8*menuDeltaY,menuWidth,menuHeight, subitems); id="刷新模式"; mapMenu.addElement(id, "刷新模式", menuDeltaX,9*menuDeltaY,menuWidth,menuHeight, switchRoleSetUp, subitems); mapMenu.addItemElement(itemEl1id, "Color", menuWidth+menuDeltaX,8*menuDeltaY,menuWidth,menuHeight, addBgColorBox); mapMenu.addItemElement(itemEl2id, "Image", menuWidth+menuDeltaX,9*menuDeltaY,menuWidth,menuHeight, addBGImagesList); } function instantiateMapGroupNormalMode() { // *** MAP MENU FOR ADMINISTRATOR*** instantiateMapGroup(); id="AdminMode"; mapMenu.addElement(id, "管理模式", menuDeltaX,4*menuDeltaY,menuWidth,menuHeight, switchRoleSetUp,null); } function instantiateMapGroup() { // ***READ ONLY MAP MENU *** var id="打开"; mapMenu.addElement(id, id, menuDeltaX,menuDeltaY,menuWidth,menuHeight, addMapsList,null); id="关闭"; mapMenu.addElement(id, id, menuDeltaX,2*menuDeltaY,menuWidth,menuHeight, closeSetUp,null); id="查询"; mapMenu.addElement(id, id, menuDeltaX,3*menuDeltaY,menuWidth,menuHeight, addSearchMapList,null); } function instantiateRefreshGroupAdminMode() { // *** REFRESH MENU *** var id = "LoadMaps"; refreshMenu.addElement(id, "Maps", menuDeltaX,menuDeltaY,menuWidth,menuHeight, loadMapsSetUp,null); id = "LoadNodes"; refreshMenu.addElement(id, "Nodes", menuDeltaX,2*menuDeltaY,menuWidth,menuHeight, loadNodesSetUp,null); id = "ReloadConfig"; refreshMenu.addElement(id, "Config", menuDeltaX,3*menuDeltaY,menuWidth,menuHeight, reloadConfigSetUp,null); } function instantiateRefreshGroupNormalMode() { // *** REFRESH MENU *** var id = "RefreshMap"; refreshMenu.addElement(id, "刷新", menuDeltaX,menuDeltaY,menuWidth,menuHeight, refreshNodesSetUp,null); } function instantiateNodeGroup() { // *** NODE MENU *** var id = "添加"; nodeMenu.addElement(id, id, menuDeltaX,menuDeltaY,menuWidth,menuHeight, addMapElementList,null); id = "AddByCategory"; nodeMenu.addElement(id, "添加分类", menuDeltaX,2*menuDeltaY,menuWidth,menuHeight, addCategoryList,null); id = "AddByLabel"; nodeMenu.addElement(id, "添加名称", menuDeltaX,3*menuDeltaY,menuWidth,menuHeight, addNodeLabelBox,null); id = "AddRange"; nodeMenu.addElement(id, "添加范围", menuDeltaX,4*menuDeltaY,menuWidth,menuHeight, addRangeBox,null); id = "AddNeigh"; nodeMenu.addElement(id, "添加嘶鸣", menuDeltaX,5*menuDeltaY,menuWidth,menuHeight, addMapElementNeigh,null); id = "AddNodeNeigh"; nodeMenu.addElement(id, "根据嘶鸣添加", menuDeltaX,6*menuDeltaY,menuWidth,menuHeight, addMapElementNeighList,null); id = "AddMap"; nodeMenu.addElement(id, "添加地图", menuDeltaX,7*menuDeltaY,menuWidth,menuHeight, addMapAsNodeList,null); id = "SetIcon"; nodeMenu.addElement(id, "设置图标", menuDeltaX,8*menuDeltaY,menuWidth,menuHeight, addIconList,null); id = "DelNode"; nodeMenu.addElement(id, "删除", menuDeltaX,9*menuDeltaY,menuWidth,menuHeight, deleteMapElementList,null); if (hasHideNodes) { id = "AddHidesNodes"; nodeMenu.addElement(id, "添加隐藏节点", menuDeltaX,10*menuDeltaY,menuWidth,menuHeight, addHideNodes,null); } if (hasHideMaps) { id = "AddHidesMaps"; nodeMenu.addElement(id, "添加隐藏地图", menuDeltaX,10*menuDeltaY,menuWidth,menuHeight, addHideMaps,null); } } function instantiateViewGroup() { // *** VIEW MENU *** var itemId="ColorNodesBy"; var itemEl1id="ColorNodesBySeverity"; var itemEl2id="ColorNodesByAvail"; var itemEl3id="ColorNodesByStatus"; var subitems= new Array(itemEl1id,itemEl2id,itemEl3id); var id="ToggleFullScreen"; viewMenu.addElement(id, "切换屏幕", menuDeltaX,menuDeltaY,menuWidth,menuHeight,toggleScreenSetUp, subitems); id = "SetDimension"; viewMenu.addElement(id, "设置尺寸", menuDeltaX,2*menuDeltaY,menuWidth,menuHeight,addDimensionList, subitems); viewMenu.addItem(itemId, "查看...", menuDeltaX,3*menuDeltaY,menuWidth,menuHeight, subitems); viewMenu.addItemElement(itemEl1id, "Severity", menuDeltaX+menuWidth,3*menuDeltaY,menuWidth,menuHeight, viewBySeveritySetUp); viewMenu.addItemElement(itemEl2id, "Avail", menuDeltaX+menuWidth,4*menuDeltaY,menuWidth,menuHeight, viewByAvailSetUp); viewMenu.addItemElement(itemEl3id, "Status", menuDeltaX+menuWidth,5*menuDeltaY,menuWidth,menuHeight,viewByStatusSetUp); viewMenu.addElement(id, "切换...", menuDeltaX,4*menuDeltaY,menuWidth,menuHeight,switchSemaphore, subitems); } // ***********functions called by Map Menu ************************ // New Map function newMapSetUp() { closeAllMenu(); if (verifyMapString()) return; hideMapInfo(); hideHistory(); clearTopInfo(); clearDownInfo(); hidePickColor(); resetFlags(); disableMenu(); mapTabSetUp(NEW_MAP_NAME); useMenu=true; newMap(); } // Search Map function addSearchMapList() { closeAllMenu(); clearTopInfo(); clearDownInfo(); hidePickColor(); resetFlags(); textbox1 = new textbox("textbox1","textboxwithcommand","",textboxmaxChars,textboxx,textboxy,textboxWidth,textboxHeight,textYOffset,textStyles,boxStyles,cursorStyles,seltextBoxStyles,"",filterSearchMapSelectionList); selMaps = new selectionList("maps","maps",mapLabels,selBoxwidth,selBoxxOffset,selBoxyOffset,selBoxCellHeight,selBoxTextpadding,selBoxheightNrElements,selBoxtextStyles,selBoxStyles,selBoxScrollbarStyles,selBoxSmallrectStyles,selBoxHighlightStyles,selBoxTriangleStyles,selBoxpreSelect,false,true,mymapsResult); selMaps.sortList("asc"); selMaps.selectElementByPosition(0, false); button1 = new button("button1","maps",searchMapSetUp,"rect","Open",undefined,buttonx,buttony,buttonwidth,buttonheight,buttonTextStyles,buttonStyles,shadeLightStyles,shadeDarkStyles,shadowOffset); } function filterSearchMapSelectionList(textboxId,value,changeType) { if (changeType == "change") { var matchingMaps = new Array(); for(var label in nodeLabelMap) { if (label.indexOf(value) >= 0) { var mapLbl = nodeLabelMap[label]; if (mapLbl!=undefined) { for (var j=0; j<mapLbl.length;j++ ){ matchingMaps.push(mapLbl[j]); } } } } var elementInList = mapLabels.length; for(var k=1;k<mapLabels.length;k++) { var mapLabel = mapLabels[k]; var match = true; for(var l=0;l<matchingMaps.length;l++) { if (matchingMaps[l] == mapLabel ) { match = false; break; } } if ( match ) { elementInList--; if (selMaps.elementExists(mapLabel) >= 0) selMaps.deleteElement(mapLabel); } else if (selMaps.elementExists(mapLabel) == -1 && match >= 0) { selMaps.addElementAtPosition(mapLabel,k); } } } } function searchMapSetUp() { if (verifyMapString()) return; if ( selMaps.elementsArray.length == 1 ) { alert("No Matching Map Found"); } else if (selectedMapInList == 0 ) { var elems = new String(); var first = true; for ( var i = 1; i< selMaps.elementsArray.length; i++ ) { if (first) { elems = mapSortAss[selMaps.elementsArray[i]].id; first = false; } else { elems = elems + "," + mapSortAss[selMaps.elementsArray[i]].id; } } windowsClean(); clearTopInfo(); clearDownInfo(); mapTabSetUp(SEARCH_MAP_NAME); useMenu=true; searchMap(elems); } else { openMapSetUp(); } } function getTopElementsString() { var elems = new String(); var first=true; for(var label in nodeLabelMap) { if (label == currentMapName ) { var mapLbl = nodeLabelMap[label]; if (mapLbl!=undefined) { for (var j=0; j<mapLbl.length;j++ ){ if (first) { elems += mapSortAss[mapLbl[j]].id; first = false; } else { elems += "," + mapSortAss[mapLbl[j]].id; } } } break; } } return elems; } function topMapSetUp(){ if (verifyMapString()) return; windowsClean(); clearTopInfo(); clearDownInfo(); mapTabSetUp(SEARCH_MAP_NAME); searchMap(getTopElementsString()); } // Open Map function addMapsList() { closeAllMenu(); clearTopInfo(); clearDownInfo(); hidePickColor(); resetFlags(); textbox1 = new textbox("textbox1","textboxwithcommand","",textboxmaxChars,textboxx,textboxy,textboxWidth,textboxHeight,textYOffset,textStyles,boxStyles,cursorStyles,seltextBoxStyles,"",filterMapSelectionList); selMaps = new selectionList("maps","maps",mapLabels,selBoxwidth,selBoxxOffset,selBoxyOffset,selBoxCellHeight,selBoxTextpadding,selBoxheightNrElements,selBoxtextStyles,selBoxStyles,selBoxScrollbarStyles,selBoxSmallrectStyles,selBoxHighlightStyles,selBoxTriangleStyles,selBoxpreSelect,false,true,mymapsResult); selMaps.sortList("asc"); selMaps.selectElementByPosition(1, true); button1 = new button("button1","maps",openMapSetUp,"rect","Open",undefined,buttonx,buttony,buttonwidth,buttonheight,buttonTextStyles,buttonStyles,shadeLightStyles,shadeDarkStyles,shadowOffset); } function filterMapSelectionList(textboxId,value,changeType) { if (changeType == "change") { var elementInList = mapLabels.length; for(var k=1;k<mapLabels.length;k++) { var mapLabel = mapLabels[k]; var match = mapLabel.indexOf(value); if ( match == -1 ) { elementInList--; if (selMaps.elementExists(mapLabel) >= 0) selMaps.deleteElement(mapLabel); } else if (selMaps.elementExists(mapLabel) == -1 && match >= 0) { selMaps.addElementAtPosition(mapLabel,k); } } if (elementInList > 1 ) selMaps.selectElementByPosition(1,true); else selMaps.selectElementByPosition(0,false); } } // This function is called by open map and add map as node! function mapsResult() { } mapsResult.prototype.getSelectionListVal = function(selBoxName,mapNr,arrayVal) { if(mapNr!=0){ writeDownInfo3("Selected Map Info", "Name: " +mapSortAss[arrayVal].getName(), "Owner: " + mapSortAss[arrayVal].getOwner() ); } selectedMapInList=arrayVal; } function openMapSetUp(mapId,setuptab) { if (verifyMapString()) return; var mapToOpen; if(mapId != undefined && (mapId > 0 || mapId == SEARCH_MAP )){ mapToOpen = mapId; if(setuptab ) { mapTabSetUp(mapidSortAss[mapToOpen]); } }else if(selectedMapInList != undefined && mapSortAss[selectedMapInList].id > 0){ mapToOpen = mapSortAss[selectedMapInList].id; mapTabSetUp(mapSortAss[selectedMapInList].name); }else{ alert("No maps to open"); return; } windowsClean(); clearTopInfo(); clearDownInfo(); useMenu=true; openMap(mapToOpen); } // Close Map function closeSetUp() { closeAllMenu(); if(currentMapId==MAP_NOT_OPENED){ alert("No maps opened"); return; } if (verifyMapString()) return; clearTopInfo(); clearDownInfo(); hidePickColor(); resetFlags(); disableMenu(); close(); } // Rename Map function addRenameMapBox(){ closeAllMenu(); if(currentMapType == "U" && currentMapId!=MAP_NOT_OPENED){ clearTopInfo(); clearDownInfo(); hidePickColor(); resetFlags(); //first a few styling parameters: textbox1 = new textbox("textbox1","textboxwithcommand",currentMapName,textboxmaxChars,textboxx,textboxy,textboxWidth,textboxHeight,textYOffset,textStyles,boxStyles,cursorStyles,seltextBoxStyles,"",undefined); button1 = new button("button1","textboxwithcommand",renameMap,"rect","Rename",undefined,buttonx,buttony,buttonwidth,buttonheight,buttonTextStyles,buttonStyles,shadeLightStyles,shadeDarkStyles,shadowOffset); } else if (currentMapType == "A") { alert('Cannot rename Automatic map'); } else if (currentMapType == "S") { alert('Cannot rename Static map'); }else{ alert('No maps opened'); } } function renameMap(){ renameMapWithName(getTextBoxValue()); } function renameMapWithName(newMapName){ mapTabRename(currentMapName,newMapName) clearTopInfo(); if(newMapName != null && trimAll(newMapName)!=""){ currentMapName=newMapName; writeMapInfo(); writeDownInfo("Map renamed."); } else { writeDownInfo("Name not valid."); } } // Delete Map function deleteMapSetUp() { closeAllMenu(); clearTopInfo(); clearDownInfo(); hidePickColor(); resetFlags(); if(currentMapType == "U" && currentMapId!=MAP_NOT_OPENED && currentMapId!=NEW_MAP){ if(confirm('Are you sure to delete the map?')==true){ disableMenu(); deleteMap(); } } else if (currentMapType == "A") { alert('Cannot delete Automatic map'); } else if (currentMapType == "S") { alert('Cannot delete Static map'); }else{ alert('No maps to delete found'); } } // Save Map function saveMapSetUp() { closeAllMenu(); if(currentMapId == MAP_NOT_OPENED){ alert("No maps opened"); } else if (currentMapId == NEW_MAP && currentMapName == NEW_MAP_NAME){ alert("Rename 'NewMap' before saving"); addRenameMapBox(); } else if (currentMapId == SEARCH_MAP && currentMapName == SEARCH_MAP_NAME){ alert("Rename 'SearchMap' before saving"); addRenameMapBox(); }else{ clearTopInfo(); disableMenu(); writeDownInfo("Saving map '" +currentMapName+"'"); resetFlags(); useMenu=true; saveMap(); } } // Clear Map function clearMapSetUp() { closeAllMenu(); hidePickColor(); resetFlags(); if(currentMapId!=MAP_NOT_OPENED) { if(confirm('Are you sure to clear the map (remove all its elements and links)?')==true) { clearTopInfo(); disableMenu(); writeDownInfo("Clearing map '" +currentMapName+"'"); clearMap(); } }else{ alert("No maps opened"); } } // Map Switch role function switchRoleSetUp(){ closeAllMenu(); clearTopInfo(); clearDownInfo(); hidePickColor(); resetFlags(); disableMenu(); switchRole(); } // Set map background Color function addBgColorBox(){ closeAllMenu(); clearTopInfo(); clearDownInfo(); resetFlags(); if(currentMapId!=MAP_NOT_OPENED){ showPickColor(); }else{ alert('No maps opened'); } } function close_pick_color(setColor) { if(setColor==true){ currentMapBackGround=pick_color.split("#")[1]; map.setBackgroundColor(pick_color); map.setBGvalue(pick_color); } if(pick_prefixe!=null){ remove_pick_color(pick_prefixe); } } // Map Background Image List function addBGImagesList() { if(currentMapId==MAP_NOT_OPENED){ alert('No maps opened'); return; } closeAllMenu(); clearTopInfo(); clearDownInfo(); hidePickColor(); resetFlags(); selBGImages = new selectionList("bgimages","bgimages",BGImages,selBoxwidth,selBoxxOffset,selBoxyOffset,selBoxCellHeight,selBoxTextpadding,selBoxheightNrElements,selBoxtextStyles,selBoxStyles,selBoxScrollbarStyles,selBoxSmallrectStyles,selBoxHighlightStyles,selBoxTriangleStyles,selBoxpreSelect,false,true,myBGImagesResult); selBGImages.sortList("asc"); button1 = new button("button1","bgimages",setBGImageSetUp,"rect","Set BG",undefined,buttonx,buttony,buttonwidth,buttonheight,buttonTextStyles,buttonStyles,shadeLightStyles,shadeDarkStyles,shadowOffset); } // Function used by previuos function function BGImagesResult() { } BGImagesResult.prototype.getSelectionListVal = function(selBoxName,mapNr,arrayVal) { if(mapNr!=0){ map.setBackgroundImage(BGImagesSortAss[arrayVal]); } selectedBGImageInList=arrayVal; } function setBGImageSetUp() { if(selectedBGImageInList!=0){ setBGImage(); } } function setBGImage(){ if(selectedBGImageInList!=0){ currentMapBackGround = BGImagesSortAss[selectedBGImageInList]; map.setBGvalue(currentMapBackGround); clearTopInfo(); writeDownInfo("Background image set"); } } // *****************Functions Called by Refresh Menu ********************** // Reload Maps List function loadMapsSetUp() { closeAllMenu(); clearTopInfo(); clearDownInfo(); hidePickColor(); resetFlags(); loadMaps(); showMapInfo(); showHistory(); } // Reload Nodes List function loadNodesSetUp() { closeAllMenu(); clearTopInfo(); clearDownInfo(); hidePickColor(); resetFlags(); loadNodes(); showMapInfo(); showHistory(); } // Reload Nodes List function reloadConfigSetUp() { closeAllMenu(); clearTopInfo(); clearDownInfo(); hidePickColor(); resetFlags(); top.writeReload("Reloading the maps configuration....."); reloadConfiguration(); } // Refresh Map function refreshNodesSetUp() { closeAllMenu(); if(currentMapId==MAP_NOT_OPENED){ alert('No maps opened'); return; } clearTopInfo(); clearDownInfo(); resetFlags(); disableMenu(); refreshNodes(); showMapInfo(); showHistory(); } // *****************Functions Called by Node Menu ********************** // Add Hide Nodes function function addHideNodes() { closeAllMenu(); clearTopInfo(); clearDownInfo(); hidePickColor(); resetFlags(); addMapElement(hideNodesIds); hideNodesIds = ""; hasHideNodes = false; } //Add Hide Nodes function function addHideMaps() { closeAllMenu(); clearTopInfo(); clearDownInfo(); hidePickColor(); resetFlags(); addMapAsNode(hideMapsIds); hideMapsIds = ""; hasHideMaps = false; } // Add Node function function addMapElementList() { closeAllMenu(); if(currentMapId==MAP_NOT_OPENED){ alert('No maps opened'); return; } clearTopInfo(); clearDownInfo(); hidePickColor(); resetFlags(); textbox1 = new textbox("textbox1","textboxwithcommand","",textboxmaxChars,textboxx,textboxy,textboxWidth,textboxHeight,textYOffset,textStyles,boxStyles,cursorStyles,seltextBoxStyles,"",filterNodeSelectionList); selNodes = new selectionList("nodes","nodes",nodeLabels,selBoxwidth,selBoxxOffset,selBoxyOffset,selBoxCellHeight,selBoxTextpadding,selBoxheightNrElements,selBoxtextStyles,selBoxStyles,selBoxScrollbarStyles,selBoxSmallrectStyles,selBoxHighlightStyles,selBoxTriangleStyles,selBoxpreSelect,false,true,mynodesResult); selNodes.sortList("asc"); selNodes.selectElementByPosition(1, true); button1 = new button("button1","nodes",addMapElementSetUp,"rect","Add",undefined,buttonx,buttony,buttonwidth,buttonheight,buttonTextStyles,buttonStyles,shadeLightStyles,shadeDarkStyles,shadowOffset); } function filterNodeSelectionList(textboxId,value,changeType) { if (changeType == "change") { var elementInList = nodeLabels.length; for(var k=1;k<nodeLabels.length;k++) { var nodeLabel = nodeLabels[k]; var match = nodeLabel.indexOf(value); if ( match == -1 ) { elementInList--; if (selNodes.elementExists(nodeLabel) >= 0) selNodes.deleteElement(nodeLabel); } else if (selNodes.elementExists(nodeLabel) == -1 && match >= 0) { selNodes.addElementAtPosition(nodeLabel,k); } } if (elementInList > 1 ) selNodes.selectElementByPosition(1,true); else selNodes.selectElementByPosition(0,false); } } function nodesResult() { } nodesResult.prototype.getSelectionListVal = function(selBoxName,nodeNr,arrayVal) { if(nodeNr!=0){ writeDownInfo3("Selected Node Info", "Label: " +nodeSortAss[arrayVal].getLabel(), "Id: "+nodeSortAss[arrayVal].getId()); } selectedMapElemInList=arrayVal; } function addMapElementSetUp() { if(selectedMapElemInList==0 ){ return; } clearDownInfo(); disableMenu(); addMapElement(nodeSortAss[selectedMapElemInList].getId()); } // Add Node by Category function addCategoryList() { closeAllMenu(); if(currentMapId==MAP_NOT_OPENED){ alert('No maps opened'); return; } clearTopInfo(); clearDownInfo(); hidePickColor(); resetFlags(); textbox1 = new textbox("textbox1","textboxwithcommand","",textboxmaxChars,textboxx,textboxy,textboxWidth,textboxHeight,textYOffset,textStyles,boxStyles,cursorStyles,seltextBoxStyles,"",filterCatSelectionList); selCategories = new selectionList("categories","categories",categories,selBoxwidth,selBoxxOffset,selBoxyOffset,selBoxCellHeight,selBoxTextpadding,selBoxheightNrElements,selBoxtextStyles,selBoxStyles,selBoxScrollbarStyles,selBoxSmallrectStyles,selBoxHighlightStyles,selBoxTriangleStyles,selBoxpreSelect,false,true,mycategoriesResult); selCategories.sortList("asc"); selCategories.selectElementByPosition(1, true); button1 = new button("button1","categories",addNodesByCategorySetUp,"rect","Add",undefined,buttonx,buttony,buttonwidth,buttonheight,buttonTextStyles,buttonStyles,shadeLightStyles,shadeDarkStyles,shadowOffset); } function filterCatSelectionList(textboxId,value,changeType) { if (changeType == "change") { var elementInList = categories.length; for(var k=1;k<categories.length;k++) { var category = categories[k]; var match = category.indexOf(value); if ( match == -1 ) { elementInList--; if (selCategories.elementExists(category) >= 0) selCategories.deleteElement(category); } else if (selCategories.elementExists(category) == -1 && match >= 0) { selCategories.addElementAtPosition(category,k); } } if (elementInList > 1 ) selCategories.selectElementByPosition(1,true); else selCategories.selectElementByPosition(0,false); } } function categoriesResult() { } categoriesResult.prototype.getSelectionListVal = function(selBoxName,nodeNr,arrayVal) { selectedCategoryInList=arrayVal; } function addNodesByCategorySetUp() { if(selectedCategoryInList==0 ) { return; } clearTopInfo(); clearDownInfo(); disableMenu(); addNodesByCategory(categorySortAss[selectedCategoryInList]); } // Add node using nodelabel function addNodeLabelBox(){ closeAllMenu(); if(currentMapId!=MAP_NOT_OPENED){ clearTopInfo(); clearDownInfo(); hidePickColor(); resetFlags(); textbox1 = new textbox("textbox1","textboxwithcommand","",textboxmaxChars,textboxx,textboxy,textboxWidth,textboxHeight,textYOffset,textStyles,boxStyles,cursorStyles,seltextBoxStyles,"[^]",undefined); button1 = new button("button1","textboxwithcommand",addNodesByLabelSetUp,"rect","Add",undefined,buttonx,buttony,buttonwidth,buttonheight,buttonTextStyles,buttonStyles,shadeLightStyles,shadeDarkStyles,shadowOffset); writeDownInfo("Label text accept wildcard"); }else{ alert('No maps opened'); } } function addNodesByLabelSetUp() { var label = getTextBoxValue(); if(label==""){ alert('Invalid Label (must not be blank)'); return; } clearTopInfo(); clearDownInfo(); disableMenu(); addNodesByLabel(label); } // Add node using ip range functions function addRangeBox(){ closeAllMenu(); if(currentMapId!=MAP_NOT_OPENED){ clearTopInfo(); clearDownInfo(); hidePickColor(); resetFlags(); textbox1 = new textbox("textbox1","textboxwithcommand","*.*.*.*",textboxmaxChars,textboxx,textboxy,textboxWidth,textboxHeight,textYOffset,textStyles,boxStyles,cursorStyles,seltextBoxStyles,"[^a-zA-Z ]",undefined); button1 = new button("button1","textboxwithcommand",addRangeOfNodesSetUp,"rect","Add",undefined,buttonx,buttony,buttonwidth,buttonheight,buttonTextStyles,buttonStyles,shadeLightStyles,shadeDarkStyles,shadowOffset); writeDownInfo3("Ip range valid are:","192.168.*.*","192.168.10-20.0-255"); }else{ alert('No maps opened'); } } function addRangeOfNodesSetUp() { var range = getTextBoxValue(); if(!isValidRange(range)){ alert('Range not valid!'); return; } clearTopInfo(); clearDownInfo(); disableMenu(); addRangeOfNodes(range); } // Add Map using neighbor function addMapElementNeigh() { closeAllMenu(); if(currentMapId==MAP_NOT_OPENED){ alert('No maps opened'); return; } if( map.getMapElementsSize()==0) { alert('Map contains no nodes'); return; } clearTopInfo(); hidePickColor(); resetFlags(); addingMapElemNeighbors=true; writeDownInfo("click element to add neighb"); } function addMapElemNeighSetUp(id) { clearTopInfo(); clearDownInfo(); disableMenu(); addMapElemNeigh(id); } // Add a node with all his neighb function function addMapElementNeighList() { closeAllMenu(); if(currentMapId==MAP_NOT_OPENED){ alert('No maps opened'); return; } clearTopInfo(); clearDownInfo(); hidePickColor(); resetFlags(); textbox1 = new textbox("textbox1","textboxwithcommand","",textboxmaxChars,textboxx,textboxy,textboxWidth,textboxHeight,textYOffset,textStyles,boxStyles,cursorStyles,seltextBoxStyles,"",filterNodeSelectionList); selNodes = new selectionList("nodes","nodes",nodeLabels,selBoxwidth,selBoxxOffset,selBoxyOffset,selBoxCellHeight,selBoxTextpadding,selBoxheightNrElements,selBoxtextStyles,selBoxStyles,selBoxScrollbarStyles,selBoxSmallrectStyles,selBoxHighlightStyles,selBoxTriangleStyles,selBoxpreSelect,false,true,mynodesResult); selNodes.sortList("asc"); selNodes.selectElementByPosition(1, true); button1 = new button("button1","nodes",addMapElementWithNeighborsSetUp,"rect","Add",undefined,buttonx,buttony,buttonwidth,buttonheight,buttonTextStyles,buttonStyles,shadeLightStyles,shadeDarkStyles,shadowOffset); } function addMapElementWithNeighborsSetUp() { if(selectedMapElemInList==0 ) { return; } clearDownInfo(); disableMenu(); addMapElementWithNeighbors(nodeSortAss[selectedMapElemInList].id); } // Add Map as a Node Functions function addMapAsNodeList(){ closeAllMenu(); if(currentMapId==MAP_NOT_OPENED){ alert('No maps opened'); return; } clearTopInfo(); clearDownInfo(); hidePickColor(); resetFlags(); textbox1 = new textbox("textbox1","textboxwithcommand","",textboxmaxChars,textboxx,textboxy,textboxWidth,textboxHeight,textYOffset,textStyles,boxStyles,cursorStyles,seltextBoxStyles,"",filterMapSelectionList); selMaps = new selectionList("maps","maps",mapLabels,selBoxwidth,selBoxxOffset,selBoxyOffset,selBoxCellHeight,selBoxTextpadding,selBoxheightNrElements,selBoxtextStyles,selBoxStyles,selBoxScrollbarStyles,selBoxSmallrectStyles,selBoxHighlightStyles,selBoxTriangleStyles,selBoxpreSelect,false,true,mymapsResult); selMaps.sortList("asc"); selMaps.selectElementByPosition(1, true); button1 = new button("button1","maps",addMapAsNodeSetUp,"rect","Add",undefined,buttonx,buttony,buttonwidth,buttonheight,buttonTextStyles,buttonStyles,shadeLightStyles,shadeDarkStyles,shadowOffset); } function addMapAsNodeSetUp() { if(selectedMapInList==0){ return; } var mapId = mapSortAss[selectedMapInList].id; if(mapId==currentMapId){ writeDownInfo("Cannot add map to itself"); return; } clearTopInfo(); clearDownInfo(); disableMenu(); addMapAsNode(mapId); } // Add icons List function function addIconList() { closeAllMenu(); if(currentMapId==MAP_NOT_OPENED){ alert('No maps opened'); return; } if( map.getMapElementsSize()==0) { alert('Map contains no nodes'); return; } clearTopInfo(); clearDownInfo(); hidePickColor(); resetFlags(); settingMapElemIcon=true; selMEIcons = new selectionList("meicons","meicons",MEIcons,selBoxwidth,selBoxxOffset,selBoxyOffset,selBoxCellHeight,selBoxTextpadding,selBoxheightNrElements,selBoxtextStyles,selBoxStyles,selBoxScrollbarStyles,selBoxSmallrectStyles,selBoxHighlightStyles,selBoxTriangleStyles,selBoxpreSelect,false,true,myMEIconsResult); selMEIcons.sortList("asc"); selMEIcons.selectElementByPosition(1,true) } function setIconSetUp() { writeDownInfo3("Icon setting ok.","Click on an element to set","another icon."); } function MEIconsResult() { } MEIconsResult.prototype.getSelectionListVal = function(selBoxName,mapNr,arrayVal) { var iconPreviewNode = document.getElementById("iconPreview"); if (iconPreviewNode) iconPreviewNode.parentNode.removeChild(iconPreviewNode); if(mapNr!=0){ selectedMEIconInList=arrayVal; var iconPreviewGroup = document.createElementNS(svgNS,"g"); iconPreviewGroup.setAttributeNS(null,"id", "iconPreview"); var iconPreviewRect = document.createElementNS(svgNS,"rect"); iconPreviewRect.setAttributeNS(null,"x", 57); iconPreviewRect.setAttributeNS(null,"y", 80); iconPreviewRect.setAttributeNS(null,"width", 35); iconPreviewRect.setAttributeNS(null,"height", 35); iconPreviewRect.setAttributeNS(null,"fill", "white"); iconPreviewRect.setAttributeNS(null,"stroke", "grey"); iconPreviewRect.setAttributeNS(null,"stroke-width", 1); var iconPreview = document.createElementNS(svgNS,"image"); iconPreview.setAttributeNS(null,"x", 65); iconPreview.setAttributeNS(null,"y", 87); iconPreview.setAttributeNS(null,"width", 20); iconPreview.setAttributeNS(null,"height", 25); iconPreview.setAttributeNS(xlinkNS, "xlink:href",MEIconsSortAss[arrayVal]); iconPreviewGroup.appendChild(iconPreviewRect); iconPreviewGroup.appendChild(iconPreview); selMEIcons.parentGroup.appendChild(iconPreviewGroup); writeDownInfo2("Click on an element to set","icon."); } else { settingMapElemIcon=false; } } // Delete Map Element List function deleteMapElementList() { closeAllMenu() if(currentMapId==MAP_NOT_OPENED){ alert('No maps opened'); return; } if( map.getMapElementsSize()==0) { alert('Map contains no nodes'); return; } clearTopInfo(); hidePickColor(); resetFlags(); deletingMapElem=true; writeDownInfo("Select the element to delete"); } function deleteMapElementSetUp() { writeDownInfo3("Element Deleted.","Click on an Other Element","to delete."); } // ***************** function called by View Menu ********** // Set element dimension function addDimensionList() { closeAllMenu(); clearTopInfo(); clearDownInfo(); resetFlags(); selMapElemDim = new selectionList("mapelemdim","mapelemdim",MapElemDim,selBoxwidth,selBoxxOffset,selBoxyOffset,selBoxCellHeight,selBoxTextpadding,selBoxheightNrElements,selBoxtextStyles,selBoxStyles,selBoxScrollbarStyles,selBoxSmallrectStyles,selBoxHighlightStyles,selBoxTriangleStyles,1,false,true,myMapElemDimResult); selMapElemDim.sortList("asc"); button1 = new button("button1","mapelemdim",setMapElemDimSetUp,"rect","Set",undefined,buttonx,buttony,buttonwidth,buttonheight,buttonTextStyles,buttonStyles,shadeLightStyles,shadeDarkStyles,shadowOffset); } function MapElemDimResult() { } MapElemDimResult.prototype.getSelectionListVal = function(selBoxName,dimNr,arrayVal) { selectedMapElemDimInList=arrayVal; } function setMapElemDimSetUp(){ mapElemDimension=parseInt(MapElemDimSortAss[selectedMapElemDimInList]); clearTopInfo(); map.render(); disableMenu(); setMapElemDim() } function viewBySeveritySetUp() { closeAllMenu(); colorSemaphoreBy='S'; refreshNodes(); clearTopInfo(); addLegend(); showMapInfo(); showHistory(); } function viewByAvailSetUp() { closeAllMenu(); colorSemaphoreBy='A'; refreshNodes(); clearTopInfo(); addLegend(); showMapInfo(); showHistory(); } function viewByStatusSetUp() { closeAllMenu(); colorSemaphoreBy='T'; refreshNodes(); clearTopInfo(); addLegend(); showMapInfo(); showHistory(); } function toggleScreenSetUp() { closeAllMenu(); top.toggle('footer'); top.toggle('header'); showMapInfo(); showHistory(); } function switchSemaphore() { closeAllMenu(); if ( useSemaphore ) useSemaphore=false; else useSemaphore=true; for (var i in map.mapElements) { map.mapElements[i].useSemaphore(useSemaphore); } } // ***************function called by clicking on count down ****************** function addRefreshTimeList() { windowsClean(); closeAllMenu(); clearTopInfo(); clearDownInfo(); resetFlags(); selRefreshTimeMins = new selectionList("refreshTime","refreshTime",refreshTimeMins,selBoxwidth,selBoxxOffset,selBoxyOffset,selBoxCellHeight,selBoxTextpadding,selBoxheightNrElements,selBoxtextStyles,selBoxStyles,selBoxScrollbarStyles,selBoxSmallrectStyles,selBoxHighlightStyles,selBoxTriangleStyles,selBoxpreSelect,false,true,myRefreshTimeMinsResult); button1 = new button("button1","refreshTime",resetRefreshTimer,"rect","Set",undefined,buttonx,buttony,buttonwidth,buttonheight,buttonTextStyles,buttonStyles,shadeLightStyles,shadeDarkStyles,shadowOffset); } function refreshTimeMinsResult() {selectedRefreshTimeList="30 seconds"; } refreshTimeMinsResult.prototype.getSelectionListVal = function(selBoxName,dimNr,arrayVal) { if(arrayVal) selectedRefreshTimeList=arrayVal; else selectedRefreshTimeList="30 seconds"; } function resetRefreshTimer(){ refreshNodesIntervalInSec=refreshTimeMinsSortAss[selectedRefreshTimeList]; clearTopInfo(); } // Top Info writing function writeTopInfoText(svgObject) { if (svgObject != null) { var topInfoText = document.getElementById("TopInfoText"); if (topInfoText != null) { clearTopInfo(); topInfoText.appendChild(svgObject); topInfoText.setAttributeNS(null,"display","inline"); } } } //clear the TopInfo SVG Object function clearTopInfo(){ if(selRefreshTimeMins!=null){ if(selRefreshTimeMins.exists==true){ selRefreshTimeMins.removeSelectionList(); selRefreshTimeMins=0; } } if(selNodes!=null){ if(selNodes.exists==true){ selNodes.removeSelectionList(); selectedMapElemInList=0; } } if(selMaps!=null){ if(selMaps.exists==true){ selMaps.removeSelectionList(); selectedMapInList=0; } } if(selCategories!=null){ if(selCategories.exists==true){ selCategories.removeSelectionList(); selectedCategoryInList=0; } } if(selBGImages!=null){ if(selBGImages.exists==true){ map.render(); selBGImages.removeSelectionList(); selectedBGImageInList=0; } } if(selMapElemDim!=null){ if(selMapElemDim.exists==true){ selMapElemDim.removeSelectionList(); selectedMapElemDimInList="15 pixel width"; } } if(selMEIcons!=null){ if(selMEIcons.exists==true){ selMEIcons.removeSelectionList(); selectedselMEIconInList=0; } } if(textbox1!= null) { textbox1.removeTextbox(); textbox1 = null; } if(button1!= null) { button1.removeButton(); button1 = null; } var topInfoText = document.getElementById("TopInfoText"); if (topInfoText ) { removeChilds(topInfoText); } } // Function to manage DownInfo Box function clearDownInfo(){ var childNode = document.getElementById("DownInfoText"); if (childNode) childNode.parentNode.removeChild(childNode); } function writeDownInfo(info){ clearDownInfo(); var text = document.createElementNS(svgNS,"text"); text.setAttributeNS(null, "x","5"); text.setAttributeNS(null, "y","20"); text.setAttributeNS(null, "font-size",titleFontSize); text.setAttributeNS(null,"font-family",textFamily); text.setAttributeNS(null, "id","DownInfoText"); var tspanContent = document.createTextNode(info); text.appendChild(tspanContent); document.getElementById("DownInfo").appendChild(text); } function writeDownInfo2(info1, info2){ clearDownInfo(); var text = document.createElementNS(svgNS,"text"); text.setAttributeNS(null, "x","5"); text.setAttributeNS(null, "y","20"); text.setAttributeNS(null, "id","DownInfoText"); text.setAttributeNS(null, "font-size",titleFontSize); text.setAttributeNS(null,"font-family",textFamily); text.appendChild(document.createTextNode(info1)); var tspan = document.createElementNS(svgNS,"tspan"); tspan.setAttributeNS(null, "x","7"); tspan.setAttributeNS(null, "dy","25"); tspan.setAttributeNS(null, "font-size",titleFontSize); tspan.setAttributeNS(null,"font-family",textFamily); var tspanContent = document.createTextNode(info2); tspan.appendChild(tspanContent); text.appendChild(tspan); document.getElementById("DownInfo").appendChild(text); } function writeDownInfo3(info1, info2, info3){ clearDownInfo(); var text = document.createElementNS(svgNS,"text"); text.setAttributeNS(null, "x","5"); text.setAttributeNS(null, "y","20"); text.setAttributeNS(null, "id","DownInfoText"); text.setAttributeNS(null, "font-size",titleFontSize); text.setAttributeNS(null,"font-family",textFamily); text.appendChild(document.createTextNode(info1)); var tspan = document.createElementNS(svgNS,"tspan"); tspan.setAttributeNS(null, "x","7"); tspan.setAttributeNS(null, "dy","25"); tspan.setAttributeNS(null, "font-size",titleFontSize); tspan.setAttributeNS(null,"font-family",textFamily); var tspanContent = document.createTextNode(info2); tspan.appendChild(tspanContent); text.appendChild(tspan); tspan = document.createElementNS(svgNS,"tspan"); tspan.setAttributeNS(null, "x","7"); tspan.setAttributeNS(null, "dy","25"); tspan.setAttributeNS(null, "font-size",titleFontSize); tspan.setAttributeNS(null,"font-family",textFamily); var tspanContent = document.createTextNode(info3); tspan.appendChild(tspanContent); text.appendChild(tspan); document.getElementById("DownInfo").appendChild(text); } // Manage MapInfo SVG Objects function hideMapInfo(){ var mapInfo = document.getElementById("MapInfo"); if(mapInfo!=null) mapInfo.setAttributeNS(null,'display', 'none'); } function showMapInfo(){ var mapInfo = document.getElementById("MapInfo"); if(mapInfo!=null) mapInfo.setAttributeNS(null,'display', 'inline'); } function writeMapInfo(){ clearMapInfo(); var hasHideText = ''; if (hasHideNodes && hasHideMaps) { hasHideText = ' : map has hidden Nodes and Maps'; } else if (hasHideNodes) { hasHideText = ' : map has hidden Nodes'; } else if (hasHideMaps) { hasHideText = ' : map has hidden Maps'; } var mapType="Unknown"; if (currentMapType == "U") { mapType="User"; } else if (currentMapType == "A") { mapType="Automatic" } else if (currentMapType == "S") { mapType="Static" } var mapInfo= document.getElementById("MapInfo"); var tspan = document.createElementNS(svgNS,"tspan"); tspan.setAttributeNS(null, "x","3"); tspan.setAttributeNS(null, "dy","15"); tspan.setAttributeNS(null, "id","MapInfoTitle"); tspan.setAttributeNS(null, "font-size",titleFontSize); var tspanContent = document.createTextNode("地图信息"+hasHideText); tspan.appendChild(tspanContent); mapInfo.appendChild(tspan); tspan = document.createElementNS(svgNS,"tspan"); tspan.setAttributeNS(null, "x","3"); tspan.setAttributeNS(null, "dy","20"); tspan.setAttributeNS(null, "id","mapName"); var tspanContent = document.createTextNode("名称:"+currentMapName+" "); tspan.appendChild(tspanContent); mapInfo.appendChild(tspan); tspan = document.createElementNS(svgNS,"tspan"); tspan.setAttributeNS(null, "x","3"); tspan.setAttributeNS(null, "dy","15"); tspan.setAttributeNS(null, "id","mapOwner"); var tspanContent = document.createTextNode("所有者:"+currentMapOwner+" "); tspan.appendChild(tspanContent); mapInfo.appendChild(tspan); tspan = document.createElementNS(svgNS,"tspan"); tspan.setAttributeNS(null, "x","3"); tspan.setAttributeNS(null, "dy","15"); tspan.setAttributeNS(null, "id","mapUserLast"); var tspanContent = document.createTextNode("用户最后修改:"+currentMapUserlast+" "); tspan.appendChild(tspanContent); mapInfo.appendChild(tspan); tspan = document.createElementNS(svgNS,"tspan"); tspan.setAttributeNS(null, "x","3"); tspan.setAttributeNS(null, "dy","15"); tspan.setAttributeNS(null, "id","mapCreateTime"); var tspanContent = document.createTextNode("创建时间:"+currentMapCreatetime+" "); tspan.appendChild(tspanContent); mapInfo.appendChild(tspan); tspan = document.createElementNS(svgNS,"tspan"); tspan.setAttributeNS(null, "x","3"); tspan.setAttributeNS(null, "dy","15"); tspan.setAttributeNS(null, "id","mapLastModTime"); var tspanContent = document.createTextNode("最后修改时间:"+currentMapLastmodtime+" "); tspan.appendChild(tspanContent); mapInfo.appendChild(tspan); tspan = document.createElementNS(svgNS,"tspan"); tspan.setAttributeNS(null, "x","3"); tspan.setAttributeNS(null, "dy","15"); tspan.setAttributeNS(null, "id","mapType"); var tspanContent = document.createTextNode("地图类型:"+mapType+" "); tspan.appendChild(tspanContent); mapInfo.appendChild(tspan); mapInfo.setAttributeNS(null,'display', 'inline'); } function clearMapInfo(){ var mapInfoTitle=document.getElementById("MapInfoTitle"); if(mapInfoTitle!=null) mapInfoTitle.parentNode.removeChild(mapInfoTitle); var mapNameNode=document.getElementById("mapName"); if(mapNameNode!=null) mapNameNode.parentNode.removeChild(mapNameNode); var mapOwnerNode=document.getElementById("mapOwner"); if(mapOwnerNode!=null) mapOwnerNode.parentNode.removeChild(mapOwnerNode); var mapUserLastNode=document.getElementById("mapUserLast"); if(mapUserLastNode!=null) mapUserLastNode.parentNode.removeChild(mapUserLastNode); var mapCreateTimeNode=document.getElementById("mapCreateTime"); if(mapCreateTimeNode!=null) mapCreateTimeNode.parentNode.removeChild(mapCreateTimeNode); var mapLastModTimeNode=document.getElementById("mapLastModTime"); if(mapLastModTimeNode!=null) mapLastModTimeNode.parentNode.removeChild(mapLastModTimeNode); var mapType=document.getElementById("mapType"); if(mapType!=null) mapType.parentNode.removeChild(mapType); } //Assert loading.. function assertLoading(){ var lt = document.getElementById("LoadingText"); if(loading==0){ lt.setAttributeNS(null,'display', 'none'); }else{ lt.setAttributeNS(null,'display', 'inline'); } } //Assert Refreshing.... function assertRefreshing(loading){ var lt = document.getElementById("RefreshingText"); if(loading==0){ lt.setAttributeNS(null,'display', 'none'); }else{ lt.setAttributeNS(null,'display', 'inline'); } } function showHistory(){ var elems = getTopElementsString(); if (elems.length > 0 ) { var topAction = document.getElementById("topAction"); topAction.setAttribute("onclick","topMapSetUp();"); document.getElementById("topGroup").setAttributeNS(null,'display', 'inline'); } else { document.getElementById("topGroup").setAttributeNS(null,'display', 'none'); } if(mapHistory.length>mapHistoryIndex+1){ var next = mapHistory[mapHistoryIndex+1]; var nextName = mapHistoryName[mapHistoryIndex+1]; //alert("nextMap id="+next+" nextName="+nextName); var textContent = document.createTextNode(nextName); var nextText = document.getElementById("nextMapName"); if(nextText.firstChild) nextText.removeChild(nextText.firstChild); nextText.appendChild(textContent); var nextAction = document.getElementById("nextAction"); nextAction.setAttribute("onclick","openMapSetUp("+next+",true);"); document.getElementById("nextGroup").setAttributeNS(null,'display', 'inline'); }else{ document.getElementById("nextGroup").setAttributeNS(null,'display', 'none'); } if(mapHistoryIndex>0){ var prev = mapHistory[mapHistoryIndex-1]; var prevName = mapHistoryName[mapHistoryIndex-1]; var textContent = document.createTextNode(prevName); var prevText = document.getElementById("prevMapName"); if(prevText.firstChild) prevText.removeChild(prevText.firstChild); prevText.appendChild(textContent); var prevAction = document.getElementById("prevAction"); prevAction.setAttribute("onclick","openMapSetUp("+prev+",true);"); document.getElementById("prevGroup").setAttributeNS(null,'display', 'inline'); }else{ document.getElementById("prevGroup").setAttributeNS(null,'display', 'none'); } document.getElementById("history").setAttributeNS(null,'display', 'inline'); } function hideHistory(){ document.getElementById("history").setAttributeNS(null,'display', 'none'); } // Display countDownText function function displayCountDown(text, editTime){ var textEl = document.getElementById("countDownText"); if(textEl.firstChild){ textEl.removeChild(textEl.firstChild); } if(editTime){ textEl.setAttributeNS(null, "cursor","pointer"); textEl.addEventListener("click", addRefreshTimeList, false); }else{ textEl.setAttributeNS(null, "cursor","default"); textEl.removeEventListener("click",addRefreshTimeList,false); } var tspan = document.createElementNS(svgNS,"tspan"); tspan.setAttributeNS(null, "dy","12"); var tspanContent = document.createTextNode(text); tspan.appendChild(tspanContent); textEl.appendChild(tspan); } // Legend Svg Object Methods function removeLegend() { var legendSVG = document.getElementById("legend"); var obj, ls; ls = legendSVG.childNodes; while (ls.length > 0) { obj = ls.item(0); legendSVG.removeChild(obj); } } function addLegend() { var legendSVG = document.getElementById("legend"); var legendHeight=legendSVG.getAttributeNS(null,"height"); var x = 1; var y = 15; var cx = 10; var cy = 23; var cr = 5; var dx = 0; var dy = 2*cr+1; var fontsize=dy-1; var ddx = 10; var ddy = 3; var legendSpace = legendHeight-y-2*fontsize; if (legendSVG.firstChild != undefined) { legendSVG.removeChild(legendSVG.firstChild); } var legendGroup = document.createElementNS(svgNS,"g"); var lgtext = document.createElementNS(svgNS,"text"); lgtext.setAttributeNS(null,"x", x); lgtext.setAttributeNS(null,"y",y); lgtext.setAttributeNS(null,"font-size",fontsize+1); lgtext.setAttributeNS(null,"font-family",textFamily); var contentText = document.createTextNode("Severity View"); if ( colorSemaphoreBy == "A") { contentText = document.createTextNode("Availability View"); var countElem = 0; for(var index in AVAIL_MIN) { if(AVAIL_MIN[index]!=undefined){ countElem++; } } var newcr = parseInt((legendSpace/countElem)/2); //divided by 2 because is r of a circle if(newcr<=cr){ cr=newcr; dy = 2*cr+1; fontsize=dy-1; } for(var index in AVAIL_MIN) { var label = ""; if (AVAIL_MIN[index] < 0) { label = "Unknown"; } else { label = " Better " + AVAIL_MIN[index] +"%"; } var item = document.createElementNS(svgNS,"circle"); item.setAttributeNS(null,"cx",cx); item.setAttributeNS(null,"cy",cy); item.setAttributeNS(null,"r",cr); item.setAttributeNS(null,"fill",AVAIL_COLOR[index]); item.setAttributeNS(null,"stroke","black"); legendGroup.appendChild(item); var textel = document.createElementNS(svgNS,"text"); textel.setAttributeNS(null,"id", label+"Text"); textel.setAttributeNS(null,"font-size",fontsize); textel.setAttributeNS(null,"font-family",textFamily); textel.setAttributeNS(null,"x", cx+ddx); textel.setAttributeNS(null,"y",cy+ddy); var labelText = document.createTextNode(label); textel.appendChild(labelText); legendGroup.appendChild(textel); cx = cx+dx; cy = cy+dy; } } else if (colorSemaphoreBy == "T") { contentText = document.createTextNode("Status View"); var countElem = 0; for(var index in STATUSES_UEI) { if(STATUSES_UEI[index]!=undefined){ countElem++; } } var newcr = parseInt((legendSpace/countElem)/2); //divided by 2 because is r of a circle if(newcr<=cr){ cr=newcr; dy = 2*cr+1; fontsize=dy-1; } for(var index in STATUSES_UEI) { var item = document.createElementNS(svgNS,"circle"); item.setAttributeNS(null,"cx",cx); item.setAttributeNS(null,"cy",cy); item.setAttributeNS(null,"r",cr); item.setAttributeNS(null,"fill",STATUSES_COLOR[index]); item.setAttributeNS(null,"stroke","black"); legendGroup.appendChild(item); var textel = document.createElementNS(svgNS,"text"); textel.setAttributeNS(null,"font-size",fontsize); textel.setAttributeNS(null,"font-family",textFamily); textel.setAttributeNS(null,"x", cx+ddx); textel.setAttributeNS(null,"y",cy+ddy); var labelText = document.createTextNode(STATUSES_TEXT[index]); textel.appendChild(labelText); legendGroup.appendChild(textel); cx = cx+dx; cy = cy+dy; } } else { var countElem = 0; for(var index in SEVERITIES_LABEL) { if(SEVERITIES_LABEL[index]!=undefined){ countElem++; } } var newcr = parseInt((legendSpace/countElem)/2); //divided by 2 because is r of a circle if(newcr<=cr){ cr=newcr; dy = 2*cr+1; fontsize=dy-1; } for(var index in SEVERITIES_LABEL) { var item = document.createElementNS(svgNS,"circle"); item.setAttributeNS(null,"cx",cx); item.setAttributeNS(null,"cy",cy); item.setAttributeNS(null,"r",cr); item.setAttributeNS(null,"fill",SEVERITIES_COLOR[index]); item.setAttributeNS(null,"stroke","black"); legendGroup.appendChild(item); var textel = document.createElementNS(svgNS,"text"); textel.setAttributeNS(null,"font-size",fontsize); textel.setAttributeNS(null,"font-family",textFamily); textel.setAttributeNS(null,"x", cx+ddx); textel.setAttributeNS(null,"y",cy+ddy); var labelText = document.createTextNode(SEVERITIES_LABEL[index]); textel.appendChild(labelText); legendGroup.appendChild(textel); cx = cx+dx; cy = cy+dy; } } lgtext.appendChild(contentText); legendGroup.appendChild(lgtext); legendSVG.appendChild(legendGroup); } function hidePickColor() { document.getElementById("pickColor").setAttributeNS(null,'display', 'none'); } function showPickColor() { add_pick_color("pickColor"); document.getElementById("pickColor").setAttributeNS(null,'display', 'inline'); } function getInfoOnMapElement(mapElement) { //var severityColor=getSeverityColor(mapElement.getSeverity()) var severityColor='black'; var severityLabel = SEVERITIES_LABEL[mapElement.getSeverity()]; //var statusColor=getStatusColor(mapElement.getStatus()); var statusColor='black' var status = STATUSES_TEXT[mapElement.getStatus()]; var avail=mapElement.getAvail(); var availColor='black'; //var availColor = getAvailColor(avail); if(avail<0){ avail="Unknown"; }else{ avail = (""+avail).substring(0,6)+"%"; } var text = document.createElementNS(svgNS,"text"); text.setAttributeNS(null, "x","3"); text.setAttributeNS(null, "dy","15"); text.setAttributeNS(null, "id","topInfoTextTitle"); var textLabel = document.createTextNode("Map Element info"); text.appendChild(textLabel); var tspan = document.createElementNS(svgNS,"tspan"); tspan.setAttributeNS(null, "x","3"); tspan.setAttributeNS(null, "dy","20"); var tspanContent = document.createTextNode(mapElement.getLabel()); tspan.appendChild(tspanContent); text.appendChild(tspan); if(mapElement.isMap()){ tspan = document.createElementNS(svgNS,"tspan"); tspan.setAttributeNS(null, "x","3"); tspan.setAttributeNS(null, "dy","15"); tspanContent = document.createTextNode("Id: "+ mapElement.getMapId() + " (Map)"); tspan.appendChild(tspanContent); text.appendChild(tspan); } if(mapElement.isNode()){ tspan = document.createElementNS(svgNS,"tspan"); tspan.setAttributeNS(null, "x","3"); tspan.setAttributeNS(null, "dy","15"); tspan.setAttributeNS(null, "id","TopInfoLabelText"); tspanContent = document.createTextNode("Id: "+ mapElement.getNodeId() + " (Node)"); tspan.appendChild(tspanContent); text.appendChild(tspan); } tspan = document.createElementNS(svgNS,"tspan"); tspan.setAttributeNS(null, "x","3"); tspan.setAttributeNS(null, "dy","15"); tspan.setAttributeNS(null, "fill",statusColor); tspanContent = document.createTextNode("Status: " + status); tspan.appendChild(tspanContent); text.appendChild(tspan); tspan = document.createElementNS(svgNS,"tspan"); tspan.setAttributeNS(null, "x","3"); tspan.setAttributeNS(null, "dy","15"); tspan.setAttributeNS(null, "fill",availColor); tspanContent = document.createTextNode("Availability: " + avail ); tspan.appendChild(tspanContent); text.appendChild(tspan); tspan = document.createElementNS(svgNS,"tspan"); tspan.setAttributeNS(null, "x","3"); tspan.setAttributeNS(null, "dy","15"); tspan.setAttributeNS(null, "fill",severityColor); tspanContent = document.createTextNode("Severity: " + severityLabel ); tspan.appendChild(tspanContent); text.appendChild(tspan); // get info return text; } function getInfoOnLink(link) { var statusColor = 'black'; var text = document.createElementNS(svgNS,"text"); text.setAttributeNS(null, "x","3"); text.setAttributeNS(null, "dy","15"); text.setAttributeNS(null, "id","topInfoTextTitle"); text.setAttributeNS(null, "font-size",titleFontSize); var textLabel = document.createTextNode("Link info"); text.appendChild(textLabel); var tspan = document.createElementNS(svgNS,"tspan"); tspan.setAttributeNS(null, "x","3"); tspan.setAttributeNS(null, "dy","20"); var nodeids = link.getNodeIds(); var numberofnodes=0; for (var k in nodeids) { numberofnodes++; if (k<8) { var tspanContent = document.createTextNode(" Linked Node: " + nodeidSortAss[nodeids[k]].getLabel()); tspan.appendChild(tspanContent); text.appendChild(tspan); tspan = document.createElementNS(svgNS,"tspan"); tspan.setAttributeNS(null, "x","3"); tspan.setAttributeNS(null, "dy","15"); } else { var tspanContent = document.createTextNode(" More Linked Node found...."); tspan.appendChild(tspanContent); text.appendChild(tspan); tspan = document.createElementNS(svgNS,"tspan"); tspan.setAttributeNS(null, "x","3"); tspan.setAttributeNS(null, "dy","15"); } } tspan.setAttributeNS(null, "fill",statusColor); tspanContent = document.createTextNode(" Status: "+link.getStatus()); tspan.appendChild(tspanContent); text.appendChild(tspan); tspan = document.createElementNS(svgNS,"tspan"); tspan.setAttributeNS(null, "x","3"); tspan.setAttributeNS(null, "dy","15"); tspanContent = document.createTextNode(" Type: "+LINK_TEXT[link.getTypology()]); tspan.appendChild(tspanContent); text.appendChild(tspan); if (LINK_SPEED[link.getTypology()] > 0 ) { var speed = LINK_SPEED[link.getTypology()]; tspan = document.createElementNS(svgNS,"tspan"); tspan.setAttributeNS(null, "x","3"); tspan.setAttributeNS(null, "dy","15"); tspanContent = document.createTextNode(" Speed: "+speed); tspan.appendChild(tspanContent); text.appendChild(tspan); } tspan = document.createElementNS(svgNS,"tspan"); tspan.setAttributeNS(null, "x","3"); tspan.setAttributeNS(null, "dy","15"); tspanContent = document.createTextNode(" Number of Links: "+link.getNumberOfLinks()); tspan.appendChild(tspanContent); text.appendChild(tspan); tspan = document.createElementNS(svgNS,"tspan"); tspan.setAttributeNS(null, "x","3"); tspan.setAttributeNS(null, "dy","15"); tspanContent = document.createTextNode(" Number of Nodes: "+numberofnodes); tspan.appendChild(tspanContent); text.appendChild(tspan); return text; } function getInfoOnSLink(slink) { var statusColor = 'black'; var text = document.createElementNS(svgNS,"text"); text.setAttributeNS(null, "x","3"); text.setAttributeNS(null, "dy","15"); text.setAttributeNS(null, "id","topInfoTextTitle"); text.setAttributeNS(null, "font-size",titleFontSize); var textLabel = document.createTextNode("Summary Link info"); text.appendChild(textLabel); var tspan = document.createElementNS(svgNS,"tspan"); tspan.setAttributeNS(null, "x","3"); tspan.setAttributeNS(null, "dy","20"); tspanContent = document.createTextNode(" Type: "+LINK_TEXT[slink.getTypology()]); tspan.appendChild(tspanContent); text.appendChild(tspan); var nodeids = slink.getNodeIds(); var numberofnodes=0; tspan = document.createElementNS(svgNS,"tspan"); tspan.setAttributeNS(null, "x","3"); tspan.setAttributeNS(null, "dy","15"); for (var k in nodeids) { numberofnodes++; if (k<8) { var tspanContent = document.createTextNode(" Linked Node: " + nodeidSortAss[nodeids[k]].getLabel()); tspan.appendChild(tspanContent); text.appendChild(tspan); tspan = document.createElementNS(svgNS,"tspan"); tspan.setAttributeNS(null, "x","3"); tspan.setAttributeNS(null, "dy","15"); } else { var tspanContent = document.createTextNode(" More Linked Node found...."); tspan.appendChild(tspanContent); text.appendChild(tspan); tspan = document.createElementNS(svgNS,"tspan"); tspan.setAttributeNS(null, "x","3"); tspan.setAttributeNS(null, "dy","15"); } } for (var linkid in slink.getLinks()) { var link = slink.getLinks()[linkid]; tspan = document.createElementNS(svgNS,"tspan"); tspan.setAttributeNS(null, "x","3"); tspan.setAttributeNS(null, "dy","15"); tspanContent = document.createTextNode(" Type: " + LINK_TEXT[link.getTypology()] + "(" + link.getNumberOfLinks() + " links)"); tspan.appendChild(tspanContent); text.appendChild(tspan); } if (LINK_SPEED[slink.getTypology()] > 0 ) { var speed = LINK_SPEED[slink.getTypology()]; tspan = document.createElementNS(svgNS,"tspan"); tspan.setAttributeNS(null, "x","3"); tspan.setAttributeNS(null, "dy","15"); tspanContent = document.createTextNode(" Speed: "+speed); tspan.appendChild(tspanContent); text.appendChild(tspan); } tspan = document.createElementNS(svgNS,"tspan"); tspan.setAttributeNS(null, "x","3"); tspan.setAttributeNS(null, "dy","15"); tspanContent = document.createTextNode(" Number of Links: "+slink.getNumberOfLinks()); tspan.appendChild(tspanContent); text.appendChild(tspan); tspan = document.createElementNS(svgNS,"tspan"); tspan.setAttributeNS(null, "x","3"); tspan.setAttributeNS(null, "dy","15"); tspanContent = document.createTextNode(" Number of MultiLinks: "+slink.getNumberOfMultiLinks()); tspan.appendChild(tspanContent); text.appendChild(tspan); tspan = document.createElementNS(svgNS,"tspan"); tspan.setAttributeNS(null, "x","3"); tspan.setAttributeNS(null, "dy","15"); tspanContent = document.createTextNode(" Number of Nodes: "+numberofnodes); tspan.appendChild(tspanContent); text.appendChild(tspan); return text; }
qoswork/opennmszh
opennms-webapp/src/main/webapp/map/svgjavascript/ApplicationMenu.js
JavaScript
gpl-2.0
59,595
YUI.add('gallery-calendar', function(Y) { //YUI.add('gallery-calendar', function (Y) { /** * calendar.js * autohr:lijing00333@163.com jayli * @class Y.Calendar * @param { string } hook or trigger * @param { object } option * @return { object } a new calendar * @requires { 'node' } * @requires { calendar-skin-default } skin * * Y.Calendar * info calendar constructor * useage new Y.Calendar(id,options); * param id:{string} container id * config selected {date} selected date * mindate:{date} min date * maxdate:{date} max date * popup:{boolean} pupup or not,false by default * closeable:{boolean} close the calendar by select a date when popup,false by default * range_select:{boolean} range select,false by default * range:{start:date,end:date} default range * multi_select:{number} pages,default number is 1 * withtime:{boolean} select date with time,false by default * date:{date} default date * navigator:{boolean} can jump to custom month,true by default useShim:{boolean} use iframe startDay:{number} start weekday offset,0 by default * Y.Calendar 's method * init * render,rewrite old params * hide * show * */ YUI.namespace('Y.Calendar'); if(typeof Y.Node.prototype.queryAll == 'undefined'){ Y.Node.prototype.queryAll = Y.Node.prototype.all; Y.Node.prototype.query = Y.Node.prototype.one; Y.Node.get = Y.Node.one; Y.get = Y.one; } Y.Calendar = function(){ this.init.apply(this,arguments); }; Y.mix(Y.Calendar,{ init:function(id,config){ var that = this; that.id = that.C_Id = id; that.buildParam(config); //形成con /* that.con,日历的容器 that.id 传进来的id that.C_Id 永远代表日历容器的ID */ if(!that.popup){ that.con = Y.one('#'+id); } else { var trigger = Y.one('#'+id); that.trigger = trigger; that.C_Id = 'C_'+Math.random().toString().replace(/.\./i,''); that.con = Y.Node.create('<div id="'+that.C_Id+'"></div>'); Y.one('body').appendChild(that.con); /* var _x = trigger.getXY()[0]; var _y = trigger.getXY()[1]+trigger.get('region').height; that.con.setStyle('left',_x.toString()+'px'); that.con.setStyle('top',_y.toString()+'px'); */ that.con.setStyle('top','0px'); that.con.setStyle('position','absolute'); that.con.setStyle('zIndex','1002'); that.con.setStyle('background','white'); that.con.setStyle('visibility','hidden'); if(that.useShim){ that.shim = Y.Node.create('<iframe border="0" frameborder="0" noscroll="yes" width="'+ that.multi_page * 191 +'px" height="193" class="calendar-iframe"></iframe>'); that.shim.setStyle('position','absolute'); that.con.insert(that.shim, 'before'); } } that.buildEventCenter(); that.render(); that.buildEvent(); return this; }, /** * 日历的事件中心 */ buildEventCenter:function(){ var that = this; var EventFactory = function(){ this.publish("select"); this.publish("switch"); this.publish("rangeselect"); this.publish("timeselect"); this.publish("selectcomplete"); this.publish("hide");//later this.publish("show");//later }; Y.augment(EventFactory, Y.Event.Target); that.EventCenter = new EventFactory(); return this; }, /** * 绑定函数 */ on:function(type,foo){ var that = this; that.EventCenter.subscribe(type,foo); return this; }, render:function(o){ var that = this; var o = o || {}; that.parseParam(o); that.ca = []; that.con.addClass('c-call clearfix multi-'+that.multi_page); that.con.set('innerHTML',''); for(var i = 0,_oym = [that.year,that.month]; i<that.multi_page;i++){ if(i == 0){ var _prev = true; }else{ var _prev = false; _oym = that.computeNextMonth(_oym); } if(i == (that.multi_page - 1)){ var _next = true; }else { var _next = false; } that.ca.push(new that.Call({ year:_oym[0], month:_oym[1], prev_arrow:_prev, next_arrow:_next, withtime:that.withtime },that)); that.ca[i].render(); /* that.ca[i].renderUI(); that.con.appendChild(that.ca[i].node); that.ca[i].buildEvent(); */ } return this; }, /** * 计算d天的前几天或者后几天,返回date */ showdate:function(n,d){ var uom = new Date(d-0+n*86400000); uom = uom.getFullYear() + "/" + (uom.getMonth()+1) + "/" + uom.getDate(); return new Date(uom); }, /** * 创建日历外框的事件 */ buildEvent:function(){ var that = this; if(!that.popup)return this; //点击空白 //flush event for(var i = 0;i<that.EV.length;i++){ if(typeof that.EV[i] != 'undefined'){ that.EV[i].detach(); } } that.EV[0] = Y.Node.get('document').on('click',function(e){ if(e.target.get('id') == that.C_Id)return; var f = e.target.ancestor(function(node){ if(node.get('id') == that.C_Id)return true; else return false; }); if(typeof f == 'undefined' || f == null){ that.hide(); } }); //点击触点 /* Y.one('#'+that.id) = that.trigger */ for(var i = 0;i<that.action.length;i++){ that.EV[1] = Y.one('#'+that.id).on(that.action[i],function(e){ e.halt(); //如果focus和click同时存在的hack Y.log(e.type); var a = that.action; if(that.inArray('click',a) && that.inArray('focus',a)){//同时含有 if(e.type == 'focus'){ that.toggle(); } }else if(that.inArray('click',a) && !that.inArray('focus',a)){//只有click if(e.type == 'click'){ that.toggle(); } }else if(!that.inArray('click',a) && that.inArray('focus',a)){//只有focus setTimeout(function(){//为了跳过document.onclick事件 that.toggle(); },170); }else { that.toggle(); } }); } return this; }, toggle:function(){ var that = this; if(that.con.getStyle('visibility') == 'hidden'){ that.show(); }else{ that.hide(); } }, inArray : function(v, a){ var o = false; for(var i=0,m=a.length; i<m; i++){ if(a[i] == v){ o = true; break; } } return o; }, /** * 显示 */ show:function(){ var that = this; that.con.setStyle('visibility',''); if(that.useShim && that.popup){ that.shim.setStyle('visibility',''); } var _x = that.trigger.getXY()[0]; var _y = that.trigger.getXY()[1]+that.trigger.get('region').height; that.con.setStyle('left',_x.toString()+'px'); that.con.setStyle('top',_y.toString()+'px'); if(that.useShim && that.popup){ that.shim.setStyle('left',_x.toString()+'px'); that.shim.setStyle('top',_y.toString()+'px'); } return this; }, /** * 隐藏 */ hide:function(){ var that = this; that.con.setStyle('visibility','hidden'); if(that.useShim && that.popup){ that.shim.setStyle('visibility','hidden'); } return this; }, handleOffset: function() { var that = this, data = ['日','一','二','三','四','五','六'], data = ['Sun','Mon','Tue','Wen','Thu','Fri','Sat'], temp = '<span>{$day}</span>', offset = that.startDay, day_html = '', a = []; for (var i = 0; i < 7; i++) { a[i] = { day:data[(i - offset + 7) % 7] }; } day_html = that.templetShow(temp, a); return { day_html:day_html }; }, /** * 创建参数列表 */ buildParam:function(o){ var that = this; if(typeof o == 'undefined' || o == null){ var o = {}; } that.date = (typeof o.date == 'undefined' || o.date == null)?new Date():o.date; that.selected = (typeof o.selected == 'undefined' || o.selected == null)?that.date:o.selected; that.multi_page = (typeof o.multi_page == 'undefined' || o.multi_page == null)?1:o.multi_page; that.closeable = (typeof o.closeable == 'undefined' || o.closeable == null)?false:o.closeable; that.range_select = (typeof o.range_select == 'undefined' || o.range_select == null)?false:o.range_select; that.mindate = (typeof o.mindate == 'undefined' || o.mindate == null)?false:o.mindate; that.maxdate = (typeof o.maxdate == 'undefined' || o.maxdate == null)?false:o.maxdate; that.multi_select = (typeof o.multi_select== 'undefined' || o.multi_select == null)?false:o.multi_select; that.navigator = (typeof o.navigator == 'undefined' || o.navigator == null)?true:o.navigator; that.arrow_left = (typeof o.arrow_left == 'undefined' || o.arrow_left == null)?false:o.arrow_left; that.arrow_right = (typeof o.arrow_right == 'undefined' || o.arrow_right == null)?false:o.arrow_right; that.popup = (typeof o.popup == 'undefined' || o.popup== null)?false:o.popup; that.withtime = (typeof o.withtime == 'undefined' || o.withtime == null)?false:o.withtime; that.startDay = (typeof o.startday == 'undefined' || o.startDay == null)?0:o.startDay; that.action = (typeof o.action == 'undefined' || o.action == null)?['click']:o.action; if(o.startDay){ that.startDay = (7 - o.startDay) % 7; } if(typeof o.useShim !== 'undefined' && o.useShim === true){ that.useShim = true; }else if(typeof o.useShim !== 'undefined' && o.useShim === false){ that.useShim = false; }else if(Y.UA.ie === 6){ that.useShim = true; }else{ that.useShim = false; } if(typeof o.range != 'undefined' && o.range != null){ var s = that.showdate(1,new Date(o.range.start.getFullYear()+'/'+(o.range.start.getMonth()+1)+'/'+(o.range.start.getDate()))); var e = that.showdate(1,new Date(o.range.end.getFullYear()+'/'+(o.range.end.getMonth()+1)+'/'+(o.range.end.getDate()))); that.range = { start:s, end:e }; //alert(Y.dump(that.range)); }else { that.range = { start:null, end:null }; } that.EV = []; return this; }, /** * 过滤参数列表 */ parseParam:function(o){ var that = this; if(typeof o == 'undefined' || o == null){ var o = {}; } for(var i in o){ that[i] = o[i]; } that.handleDate(); return this; }, /** * 得到某月有多少天,需要给定年来判断闰年 */ getNumOfDays:function(year,month){ return 32-new Date(year,month-1,32).getDate(); }, /** * 模板函数,应当在base中 */ templetShow : function(templet, data){ var that = this; if(data instanceof Array){ var str_in = ''; for(var i = 0;i<data.length;i++){ str_in += that.templetShow(templet,data[i]); } templet = str_in; }else{ var value_s = templet.match(/{\$(.*?)}/g); if(data !== undefined && value_s != null){ for(var i=0, m=value_s.length; i<m; i++){ var par = value_s[i].replace(/({\$)|}/g, ''); value = (data[par] !== undefined) ? data[par] : ''; templet = templet.replace(value_s[i], value); } } } return templet; }, /** * 处理日期 */ handleDate:function(){ /* that.month that.year that.selected that.mindate that.maxdate */ var that = this; var date = that.date; that.weekday= date.getDay() + 1;//星期几 //指定日期是星期几 that.day = date.getDate();//几号 that.month = date.getMonth();//月份 that.year = date.getFullYear();//年份 return this; }, //get标题 getHeadStr:function(year,month){ return (Number(month)+1).toString()+'/'+year.toString(); }, //月加 monthAdd:function(){ var that = this; if(that.month == 11){ that.year++; that.month = 0; }else{ that.month++; } that.date = new Date(that.year.toString()+'/'+(that.month+1).toString()+'/1'); return this; }, //月减 monthMinus:function(){ var that = this; if(that.month == 0){ that.year-- ; that.month = 11; }else{ that.month--; } that.date = new Date(that.year.toString()+'/'+(that.month+1).toString()+'/1'); return this; }, //裸算下一个月的年月,[2009,11],年:fullYear,月:从0开始计数 computeNextMonth:function(a){ var that = this; var _year = a[0]; var _month = a[1]; if(_month == 11){ _year++; _month = 0; }else{ _month++; } return [_year,_month]; }, //处理箭头 handleArrow:function(){ }, //得到范围 getRange:function(){ }, //得到当前选中 getSelect:function(){ }, //处理起始日期,d:Date类型 handleRange : function(d){ var that = this; if((that.range.start == null && that.range.end == null )||(that.range.start != null && that.range.end != null)){ that.range.start = d; that.range.end = null; that.render(); }else if(that.range.start != null && that.range.end == null){ that.range.end = d; if(that.range.start.getTime() > that.range.end.getTime()){ var __t = that.range.start; that.range.start = that.range.end; that.range.end = __t; } that.EventCenter.fire('rangeselect',that.range); that.render(); } return this; }, //constructor /** * TimeSelector只支持选择,不支持初始化 */ TimeSelector:function(ft,fathor){ //属性------------------ this.fathor = fathor; this.fcon = ft.ancestor('.c-box');//cc容器 this.popupannel = this.fcon.query('.selectime');//点选时间的弹出层 if(typeof fathor._time == 'undefined'){//确保初始值和当前时间一致 fathor._time = new Date(); } this.time = fathor._time; this.status = 's';//当前选择的状态,'h','m','s'依次判断更新哪个值 this.ctime = Y.Node.create('<div class="c-time">Time:<span class="h">h</span>:<span class="m">m</span>:<span class="s">s</span><!--{{arrow--><div class="cta"><button class="u"></button><button class="d"></button></div><!--arrow}}--></div>'); this.button = Y.Node.create('<button class="ct-ok">OK</button>'); //小时 //FIXME this is the am/pm time string // this.h_a = ['12a','1a','2a','3a','4a','5a','6a','7a','8a','9a','10a','11a','12p','1p','2p','3p','4p','5p','6p','7p','8p','9p','10p','11p']; this.h_a = ['00','01','02','03','04','05','06','07','08','09','10','11','12','13','14','15','16','17','18','19','20','21','22','23']; //分钟 this.m_a = ['00','10','20','30','40','50']; //秒 this.s_a = ['00','10','20','30','40','50']; //接口---------------- /** * 创建相应的容器html,值均包含在a中 * 参数:要拼装的数组 * 返回:拼好的innerHTML,结尾还要带一个关闭的a * */ this.parseSubHtml = function(a){ var in_str = ''; for(var i = 0;i<a.length;i++){ in_str += '<a href="javascript:void(0);" class="item">'+a[i]+'</a>'; //FIXME add <br> if (i+1)%6==0 } in_str += '<a href="javascript:void(0);" class="x">x</a>'; return in_str; }; /** * 显示selectime容器 * 参数,构造好的innerHTML */ this.showPopup= function(instr){ var that = this; this.popupannel.set('innerHTML',instr); this.popupannel.removeClass('hidden'); var status = that.status; var _con = that.ctime; that.ctime.queryAll('span').removeClass('on'); switch(status){ case 'h': that.ctime.query('.h').addClass('on'); break; case 'm': that.ctime.query('.m').addClass('on'); break; case 's': that.ctime.query('.s').addClass('on'); break; } }; /** * 隐藏selectime容器 */ this.hidePopup= function(){ this.popupannel.addClass('hidden'); }; /** * 不对其做更多的上下文假设,仅仅根据time显示出来 */ this.render = function(){ var that = this; var h = that.get('h'); var m = that.get('m'); var s = that.get('s'); that.fathor._time = that.time; that.ctime.query('.h').set('innerHTML',h); that.ctime.query('.m').set('innerHTML',m); that.ctime.query('.s').set('innerHTML',s); return that; }; //这里的set和get都只是对time的操作,并不对上下文做过多假设 /** * set(status,v) * h:2,'2' */ this.set = function(status,v){ var that = this; var v = Number(v); switch(status){ case 'h': //FIXME here's where we'd parse the am/pm display that.time.setHours(v); break; case 'm': that.time.setMinutes(v); break; case 's': that.time.setSeconds(v); break; } that.render(); }; /** * get(status) */ this.get = function(status){ var that = this; var time = that.time; switch(status){ case 'h': return time.getHours(); break; case 'm': return time.getMinutes(); break; case 's': return time.getSeconds(); break; } }; /** * add() * 状态值代表的变量增1 */ this.add = function(){ var that = this; var status = that.status; var v = that.get(status); v++; that.set(status,v); }; /** * minus() * 状态值代表的变量增1 */ this.minus= function(){ var that = this; var status = that.status; var v = that.get(status); v--; that.set(status,v); }; //构造--------- this.init = function(){ var that = this; ft.set('innerHTML','').append(that.ctime); ft.append(that.button); that.render(); that.popupannel.on('click',function(e){ var el = e.target; if(el.hasClass('x')){//关闭 that.hidePopup(); return; }else if(el.hasClass('item')){//点选一个值 var v = Number(el.get('innerHTML')); that.set(that.status,v); that.hidePopup(); return; } }); //确定的动作 that.button.on('click',function(e){ var d = typeof that.fathor.dt_date == 'undefined'?that.fathor.date:that.fathor.dt_date; d.setHours(that.get('h')); d.setMinutes(that.get('m')); d.setSeconds(that.get('s')); that.fathor.EventCenter.fire('timeselect',d); if(that.fathor.popup && that.fathor.closeable){ that.fathor.hide(); } }); //ctime上的键盘事件,上下键,左右键的监听 //TODO 考虑是否去掉 that.ctime.on('keyup',function(e){ if(e.keyCode == 38 || e.keyCode == 37){//up or left e.halt(); that.add(); } if(e.keyCode == 40 || e.keyCode == 39){//down or right e.halt(); that.minus(); } }); //上的箭头动作 that.ctime.query('.u').on('click',function(e){ that.hidePopup(); that.add(); }); //下的箭头动作 that.ctime.query('.d').on('click',function(e){ that.hidePopup(); that.minus(); }); //弹出选择小时 that.ctime.query('.h').on('click',function(e){ var in_str = that.parseSubHtml(that.h_a); that.status = 'h'; that.showPopup(in_str); }); //弹出选择分钟 that.ctime.query('.m').on('click',function(e){ var in_str = that.parseSubHtml(that.m_a); that.status = 'm'; that.showPopup(in_str); }); //弹出选择秒 that.ctime.query('.s').on('click',function(e){ var in_str = that.parseSubHtml(that.s_a); that.status = 's'; that.showPopup(in_str); }); }; this.init(); }, //constructor /** * 子日历构造器 * @constructor Y.Calendar.prototype.Call * @param {object} config ,参数列表,需要指定子日历所需的年月 * @param {object} fathor,指向Y.Calendar实例的指针,需要共享父框的参数 * @return 子日历的实例 */ Call:function(config,fathor){ //属性 this.fathor = fathor; this.month = Number(config.month); this.year = Number(config.year); this.prev_arrow = config.prev_arrow; this.next_arrow = config.next_arrow; this.node = null; this.timmer = null;//时间选择的实例 this.id = ''; this.EV = []; this.html = [ '<div class="c-box" id="{$id}">', '<div class="c-hd">', '<a href="javascript:void(0);" class="prev {$prev}"><</a>', '<a href="javascript:void(0);" class="title">{$title}</a>', '<a href="javascript:void(0);" class="next {$next}">></a>', '</div>', '<div class="c-bd">', '<div class="whd">', /* '<span>日</span>', '<span>一</span>', '<span>二</span>', '<span>三</span>', '<span>四</span>', '<span>五</span>', '<span>六</span>', */ fathor.handleOffset().day_html, '</div>', '<div class="dbd clearfix">', '{$ds}', /* <a href="" class="null">1</a> <a href="" class="disabled">3</a> <a href="" class="selected">1</a> <a href="" class="today">1</a> <a href="">1</a> */ '</div>', '</div>', '<div class="setime hidden">', '</div>', '<div class="c-ft {$showtime}">', '<div class="c-time">', '时间:00:00 &hearts;', '</div>', '</div>', '<div class="selectime hidden"><!--用以存放点选时间的一些关键值-->', '</div>', '</div><!--#c-box-->' ].join(""); this.nav_html = [ '<p>', 'Month', '<select value="{$the_month}">', '<option class="m1" value="1">01</option>', '<option class="m2" value="2">02</option>', '<option class="m3" value="3">03</option>', '<option class="m4" value="4">04</option>', '<option class="m5" value="5">05</option>', '<option class="m6" value="6">06</option>', '<option class="m7" value="7">07</option>', '<option class="m8" value="8">08</option>', '<option class="m9" value="9">09</option>', '<option class="m10" value="10">10</option>', '<option class="m11" value="11">11</option>', '<option class="m12" value="12">12</option>', '</select>', '</p>', '<p>', 'Year', '<input type="text" value="{$the_year}" onfocus="this.select()"></input>', '</p>', '<p>', '<button class="ok">OK</button><button class="cancel">Cancel</button>', '</p>' ].join(""); //常用的数据格式的验证 this.Verify = function() { var isDay = function(n) { if (!/^\d+$/i.test(n))return false; n = Number(n); return !(n < 1 || n > 31); }, isYear = function(n) { if (!/^\d+$/i.test(n))return false; n = Number(n); return !(n < 100 || n > 10000); }, isMonth = function(n) { if (!/^\d+$/i.test(n))return false; n = Number(n); return !(n < 1 || n > 12); }; return { isDay:isDay, isYear:isYear, isMonth:isMonth }; }; //方法 /** * 渲染子日历的UI */ this.renderUI = function(){ var cc = this; cc.HTML = ''; var _o = {}; _o.prev = ''; _o.next = ''; _o.title = ''; _o.ds = ''; if(!cc.prev_arrow){ _o.prev = 'hidden'; } if(!cc.next_arrow){ _o.next = 'hidden'; } if(!cc.fathor.showtime){ _o.showtime = 'hidden'; } _o.id = cc.id = 'cc-'+Math.random().toString().replace(/.\./i,''); _o.title = cc.fathor.getHeadStr(cc.year,cc.month); cc.createDS(); _o.ds = cc.ds; //cc.node = Y.Node.create(cc.fathor.templetShow(cc.html,_o)); cc.fathor.con.appendChild(Y.Node.create(cc.fathor.templetShow(cc.html,_o))); cc.node = Y.one('#'+cc.id); if(cc.fathor.withtime){ var ft = cc.node.query('.c-ft'); ft.removeClass('hidden'); cc.timmer = new cc.fathor.TimeSelector(ft,cc.fathor); } return this; }; /** * 创建子日历的事件 */ this.buildEvent = function(){ var cc = this; var con = Y.one('#'+cc.id); //flush event for(var i = 0;i<cc.EV.length;i++){ if(typeof cc.EV[i] != 'undefined'){ cc.EV[i].detach(); } } cc.EV[0] = con.query('div.dbd').on('click',function(e){ e.halt(); if(e.target.hasClass('null'))return; if(e.target.hasClass('disabled'))return; var selectedd = Number(e.target.get('innerHTML')); var d = new Date(cc.year+'/'+Number(cc.month+1)+'/'+selectedd); /* d.setYear(cc.year); d.setMonth(cc.month); d.setDate(selectedd); */ //that.callback(d); //datetime的date if(cc.fathor.withtime){ d.setHours(cc.timmer.get('h')); d.setMinutes(cc.timmer.get('m')); d.setSeconds(cc.timmer.get('s')); } cc.fathor.dt_date = d; cc.fathor.EventCenter.fire('select',d); if(cc.fathor.popup && cc.fathor.closeable){ cc.fathor.hide(); } if(cc.fathor.range_select){ cc.fathor.handleRange(d); } cc.fathor.render({selected:d}); }); //向前 cc.EV[1] = con.query('a.prev').on('click',function(e){ e.halt(); cc.fathor.monthMinus().render(); cc.fathor.EventCenter.fire('switch',new Date(cc.fathor.year+'/'+(cc.fathor.month+1)+'/01')); }); //向后 cc.EV[2] = con.query('a.next').on('click',function(e){ e.halt(); cc.fathor.monthAdd().render(); cc.fathor.EventCenter.fire('switch',new Date(cc.fathor.year+'/'+(cc.fathor.month+1)+'/01')); }); if(cc.fathor.navigator){ cc.EV[3] = con.query('a.title').on('click',function(e){ e.halt(); try{ cc.timmer.hidePopup(); }catch(e){} var setime_node = con.query('.setime'); setime_node.set('innerHTML',''); var in_str = cc.fathor.templetShow(cc.nav_html,{ the_month:cc.month+1, the_year:cc.year }); setime_node.set('innerHTML',in_str); setime_node.removeClass('hidden'); con.query('input').on('keydown',function(e){ var _month = con.one('.setime select').get('value'); var _year = con.one('.setime input').get('value'); if(e.keyCode == 38){//up if (!cc.Verify().isYear(_year))return; if (!cc.Verify().isMonth(_month))return; e.target.set('value',Number(e.target.get('value'))+1); e.target.select(); } if(e.keyCode == 40){//down if (!cc.Verify().isYear(_year))return; if (!cc.Verify().isMonth(_month))return; e.target.set('value',Number(e.target.get('value'))-1); e.target.select(); } if(e.keyCode == 13){//enter con.query('.setime').addClass('hidden'); if (!cc.Verify().isYear(_year))return; if (!cc.Verify().isMonth(_month))return; cc.fathor.render({ date:new Date(_year+'/'+_month+'/01') }) cc.fathor.EventCenter.fire('switch',new Date(_year+'/'+_month+'/01')); } }); }); cc.EV[4] = con.query('.setime').on('click',function(e){ e.halt(); if(e.target.hasClass('ok')){ var _month = con.query('.setime').query('select').get('value'); var _year = con.query('.setime').query('input').get('value'); con.query('.setime').addClass('hidden'); if (!cc.Verify().isYear(_year))return; if (!cc.Verify().isMonth(_month))return; cc.fathor.render({ date:new Date(_year+'/'+_month+'/01') }) cc.fathor.EventCenter.fire('switch',new Date(_year+'/'+_month+'/01')); }else if(e.target.hasClass('cancel')){ con.query('.setime').addClass('hidden'); } }); } return this; }; /** * 得到当前子日历的node引用 */ this.getNode = function(){ var cc = this; return cc.node; }; /** * 生成日期的html */ this.createDS = function(){ var cc = this; var s = ''; var startweekday = (new Date(cc.year + '/' + (cc.month + 1) + '/01').getDay() + cc.fathor.startDay + 7) % 7;//当月第一天是星期几 var k = cc.fathor.getNumOfDays(cc.year,cc.month + 1) + startweekday; for(var i = 0;i< k;i++){ //prepare data {{ if(/532/.test(Y.UA.webkit)){//hack for chrome var _td_s = new Date(cc.year+'/'+Number(cc.month+1)+'/'+(i+1-startweekday).toString()); }else { var _td_s = new Date(cc.year+'/'+Number(cc.month+1)+'/'+(i+2-startweekday).toString()); } var _td_e = new Date(cc.year+'/'+Number(cc.month+1)+'/'+(i+1-startweekday).toString()); //prepare data }} if(i < startweekday){//null s += '<a href="javascript:void(0);" class="null">0</a>'; }else if( cc.fathor.mindate instanceof Date && new Date(cc.year+'/'+(cc.month+1)+'/'+(i+2-startweekday)).getTime() < (cc.fathor.mindate.getTime()+1) ){//disabled s+= '<a href="javascript:void(0);" class="disabled">'+(i - startweekday + 1)+'</a>'; }else if(cc.fathor.maxdate instanceof Date && new Date(cc.year+'/'+(cc.month+1)+'/'+(i+1-startweekday)).getTime() > cc.fathor.maxdate.getTime() ){//disabled s+= '<a href="javascript:void(0);" class="disabled">'+(i - startweekday + 1)+'</a>'; }else if((cc.fathor.range.start != null && cc.fathor.range.end != null) //日期选择范围 && ( _td_s.getTime()>=cc.fathor.showdate(1,cc.fathor.range.start).getTime() && _td_e.getTime() < cc.fathor.showdate(1,cc.fathor.range.end).getTime()) ){ //alert(Y.dump(_td_s.getDate())); if(i == (startweekday + (new Date()).getDate() - 1) && (new Date()).getFullYear() == cc.year && (new Date()).getMonth() == cc.month){//今天并被选择 s+='<a href="javascript:void(0);" class="range today">'+(i - startweekday + 1)+'</a>'; }else{ s+= '<a href="javascript:void(0);" class="range">'+(i - startweekday + 1)+'</a>'; } }else if(i == (startweekday + (new Date()).getDate() - 1) && (new Date()).getFullYear() == cc.year && (new Date()).getMonth() == cc.month){//today s += '<a href="javascript:void(0);" class="today">'+(i - startweekday + 1)+'</a>'; }else if(i == (startweekday + cc.fathor.selected.getDate() - 1) && cc.month == cc.fathor.selected.getMonth() && cc.year == cc.fathor.selected.getFullYear()){//selected s += '<a href="javascript:void(0);" class="selected">'+(i - startweekday + 1)+'</a>'; }else{//other s += '<a href="javascript:void(0);">'+(i - startweekday + 1)+'</a>'; } } if(k%7 != 0){ for(var i = 0;i<(7-k%7);i++){ s += '<a href="javascript:void(0);" class="null">0</a>'; } } cc.ds = s; return this; }; /** * 渲染 */ this.render = function(){ var cc = this; cc.renderUI(); cc.buildEvent(); return this; }; }//Call constructor over },0,null,4); }, '@VERSION@' ,{requires:['node']});
exponentcms/exponent-cms
framework/modules/events/assets/js/calendar.js
JavaScript
gpl-2.0
29,641
$(document).ready(function () { 'use strict'; // Set up the connection var field, socket, output; socket = io.connect(window.location.href); // Get a reference to the input field = $('textarea#message'); // Get a reference to the output output = $('div.conversation'); // Handle message submit $('a#submitbutton').on('click', function () { // Create the message var msg; msg = field.val(); socket.emit('send', { message: msg }); field.val(''); }); // Handle incoming messages socket.on('message', function (data) { // Insert the message output.append('<p>' + data + '</p>'); }); });
matthewbdaly/babblr
static/js/main.js
JavaScript
gpl-2.0
700
var selected = jQuery('.cmb-td option[selected="selected"]'); selected.each(function(index){ if ( 'none' == jQuery(this).val() ) { jQuery(this).parent().parent().parent().hide(); jQuery('button.cmb-add-row-button').click(function(){ jQuery('.empty-row.hidden').show(); }); } });
wp-plugins/wds-simple-page-builder
assets/js/admin.js
JavaScript
gpl-2.0
290
define( "dijit/nls/tr/common", //begin v1.x content ({ buttonOk: "Tamam", buttonCancel: "İptal", buttonSave: "Kaydet", itemClose: "Kapat" }) //end v1.x content );
Aksh2/Websites
Shears Design/js/libraries/dojo-release-1.7.3/dijit/nls/tr/common.js.uncompressed.js
JavaScript
gpl-2.0
168
/* Any site-specific scripts you might have. Note that <html> innately gets a class of "no-js". This is to allow you to react to non-JS users. Recommend removing that and adding "js" as one of the first things your script does. Note that if you are using Modernizr, it already does this for you. :-) */ /*****Menu Desplegable*****/ $(function(){ if(!/Android|webOS|iPhone|iPod|iPad|BlackBerry/i.test(navigator.userAgent) ) { $("ul.sub-menu").parents().addClass('sub-menu-parent'); // Oculto los submenus $("#menu-menu-principal ul.sub-menu-parent").css('display', 'none'); // Defino que submenus deben estar visibles cuando se pasa el mouse por encima $('#menu-menu-principal li').hover(function(){ $(this).find('ul.sub-menu:first:hidden').slideDown(400); $('sub-menu').show(); },function(){ $(this).find('ul.sub-menu:first').slideUp(400); }); } }); /*****Flexislider Home y Galería Proyectos*****/ $(function() { // if ($(window).width() <= 767) { $('#home-gallery').flexslider({ animation: "slide", slideshow: false, controlNav: true, directionNav: true, keyboardNav: true, pauseOnAction: true, pauseOnHover: false, touch: true, animationLoop: true, after: function(){ var new_img = $('.flex-active-slide').children('img.this').attr('title'); $.backstretch('' + new_img + ''); } }); //} else { $('#home-gallery').flexslider({ animation: "fade", slideshow: true, controlNav: true, directionNav: false, touch: true, after: function(){ var new_img = $('.flex-active-slide').children('img.this').attr('title'); $.backstretch('' + new_img + ''); } }); //} // Home if ($('body').hasClass('home')) { var new_img = $('.flex-active-slide').children('img.this').attr('title'); $.backstretch(new_img, {duration: 2000, fade: 750}); } // Proyecto $('#proyect-gallery').flexslider({ animation: "slide", slideshow: false, selector: ".slides > li", directionNav: true, keyboardNav: true, controlNav: false }); // Inmobiliaria $('#housing-gallery').flexslider({ animation: "slide", controlNav: false, animationLoop: false, slideshow: false, selector: ".slides > li" }); }); /*****Proyectos Pag Inicio muestra img*****/ if (!$(window).width() <= 767) { $(function(){ $('.home-project').each( function(i,content){ $(content).hover( function(){ $(this).find('a.img img').animate({scale: 1.4},{duration:200}); }, function(){ $(this).find('a.img img').animate({scale: 1},{duration:200}); }); } ); }); } /*****Color de font en listado proyectos*****/ $(function () { var colorgray= $('body').hasClass('category-proyectos'); if (colorgray == true) { $('body').css({'background-color' : '#242424'}).animate({'opacity': 1}, 600); } else { $('body').css({'background-color' : '#ffffff'}).animate({'opacity': 1}, 600); } $(window).bind("load", function() { //The load event will only fire if the entire page or document is fully loaded int = setInterval(changecolor, 200); //200 is the fade in speed in milliseconds }); function changecolor() { var classwhite = $('body').hasClass('category-proyectos'); if (classwhite == true) { $('body').attr('id', 'white'); clearInterval(int); } } }); /*****Listado de proyectos*****/ $(function () { $("#single-proyectos #nav li:nth-child(6n+6)").addClass("mar-right-0"); // Fade del load project and filter tag $(function () { $('.project-item').hide();//hide all the images on the page }); var i = 0; //initialize var int=0; //Internet Explorer Fix $(window).bind("load", function() { //The load event will only fire if the entire page or document is fully loaded int = setInterval(doThis, 200); //200 is the fade in speed in milliseconds }); function doThis() { var imgs = $('.project-item').length; //count the number of images on the page if (i >= imgs) { // Loop the images clearInterval(int); //When it reaches the last image the loop ends } $('.project-item:hidden').eq(0).fadeIn(200); //fades in the hidden images one by one i++;//add 1 to the count } var findcat = $('.submenu-cat li').hasClass('current-cat'); //console.log(findcat); if (findcat == false) { $('li.all').addClass('current-cat'); } else { $('li.all').removeClass('current-cat'); } /*----last child----*/ $("#projects li.mar-right-0").css("margin-right","0"); $("#housing li:nth-child(2n+2)").css("margin-right","0"); $(".home-project:last-child").css("padding-right", "0"); $(".home-project:last-child").css("border-right", "0"); }); /*****Listado de inmobiliaria*****/ $(function(){ if ( $('#housing').length) { var $container = $('#housing'); $container.imagesLoaded( function(){ $container.isotope({ // options //itemSelector : 'article', layoutMode : 'masonry', itemPositionDataEnabled: true }); }); } }); /*****Mostrar Compartir Botones Sociales*****/ $(function(){ $("a.btn_share").bind('click focus', function(){ $('#single-proyectos #post-social').toggleClass('show'); }); }); $(function(){ winh = $('body').width(); if (winh < 560) { $('#housing li img').removeAttr('height'); } }); /***** Menu mobile *****/ $(function($){ $('#btn-menu-movil') .bind('click focus', function(){ $('#nav-mobile').slideToggle(); $('#btn-menu-movil').toggleClass('active'); $('.backstretch').toggleClass('active'); }); $('#nav-mobile span') .bind('click focus', function(){ $('#nav-mobile').slideToggle(); $('#btn-menu-movil').toggleClass('active'); $('.backstretch').toggleClass('active'); }); });
Floristeady/wallarquitectura
js/script.js
JavaScript
gpl-2.0
6,015
(function ($, Drupal) { Drupal.behaviors.myModuleBehavior = { attach: function (context, settings) { function generateUrlParams(){ var result = []; //check that we have already submitted pagination info let searchParams = new URLSearchParams(window.location.href); var urlPage = searchParams.get('page'); var urlLimit = searchParams.get('limit'); var urlOrder = searchParams.get('order'); //remove the # sign from the url result["urlPage"] = removeSpecialChar(urlPage); result["urlLimit"] = removeSpecialChar(urlLimit); result["urlOrder"] = removeSpecialChar(urlOrder); var insideUri = $('#insideUri').val(); if(insideUri){ insideUri = insideUri.replace('id.acdh.oeaw.ac.at/uuid/', ''); result["insideUri"] = insideUri; } //check the checkbox values var limitSel = $('#limit-sel').val(); if(!limitSel){ limitSel = 10; } var orderbySel = $('#orderby').val(); if(!orderbySel){ orderbySel = 'asc'; } result["limitSel"] = limitSel; result["orderbySel"] = orderbySel; var maxPage = 0; maxPage = $('#maxPage').val(); var maxPageLimit = 0; result["maxPage"] = maxPage; var limit = 0; var page = 0; var orderBy = "asc"; // if we have already submitted page and/or limit infos then if(urlPage && urlLimit){ //display the child view $('#ajax-pagination').show(); if(!urlOrder){ urlOrder = orderbySel; } limit = urlLimit; page = urlPage; orderBy = urlOrder; // we check the maxPage and if the actual page is bigger // then we change the page if( maxPage > 0) { maxPageLimit = Math.ceil(maxPage / limit); if( page > maxPageLimit) { page = maxPageLimit; } } }else{ page = 1; limit = limitSel; orderBy = orderbySel; } if(page >= maxPageLimit){ $( "#next-btn" ).attr('disabled', true); $( "#next-btn" ).removeAttr("href"); $( "#last-btn" ).attr('disabled', true); $( "#last-btn" ).removeAttr("href"); }else{ $( "#next-btn" ).attr('disabled', false); $( "#next-btn" ).attr("href"); $( "#last-btn" ).attr('disabled', false); $( "#last-btn" ).attr("href"); } if(page === 1){ $( "#prev-btn" ).attr('disabled', true); $( "#prev-btn" ).removeAttr("href"); $( "#first-btn" ).attr('disabled', true); $( "#first-btn" ).removeAttr("href"); }else{ $( "#prev-btn" ).attr('disabled', false); $( "#prev-btn" ).attr("href"); $( "#first-btn" ).attr('disabled', false); $( "#first-btn" ).attr("href"); } result["maxPageLimit"] = $('#maxPageLimit').val(); return result; } if(window.location.href.indexOf("/oeaw_detail/") > -1) { $(".loader-div").hide(); if(window.location.href.indexOf("&page=") > -1) { var urlParams = generateUrlParams(); var urlPage = urlParams['urlPage']; var urlLimit = urlParams['urlLimit']; var urlOrder = urlParams['urlOrder']; var maxPageLimit = urlParams['maxPageLimit']; var insideUri = urlParams['insideUri']; getData(insideUri, urlLimit, urlPage, urlOrder); } } /** * Do the API request to get the actual child data * * @param {type} insideUri * @param {type} limit * @param {type} page * @param {type} orderby * @returns {undefined} */ function getData(insideUri, limit, page, orderby) { $.ajax({ url: '/browser/oeaw_child_api/'+insideUri+'/'+limit+'/'+page+'/'+orderby, data: {'ajaxCall':true}, async: true, success: function(result){ //empty the data div, to display the new informations $('#child-div-content').html(result); $(".loader-div").hide(); $('#limit-sel').val(limit); $('#actualPageSpan').val(page); $('#orderby').val(orderby); return false; }, error: function(error){ $('#child-div-content').html('<div>There is no data</div>'); $(".loader-div").hide(); return false; } }); } /** * Remove the # sign from the url * * @param {type} str * @returns string */ function removeSpecialChar(str){ if ( str && str.indexOf('#') > -1) { str = str.replace('#', ''); } return str; } /** * create and change the new URL after click events * * @type Arguments */ function createNewUrl(page, limit, orderBy){ if (history.pushState) { var path = window.location.pathname; var newUrlLimit = "&limit="+limit; var newUrlPage = "&page="+page; var newUrlOrder = "&order="+orderBy; var cleanPath = ""; if(path.indexOf('&') != -1){ cleanPath = path.substring(0, path.indexOf('&')); }else { cleanPath = path; } var newurl = window.location.protocol + "//" + window.location.host + cleanPath + newUrlPage + newUrlLimit + newUrlOrder; window.history.pushState({path:newurl},'',newurl); } } $(document ).delegate( ".getChildView", "click", function(e) { //drupalSettings.oeaw.detailView.insideUri.page = 1; e.preventDefault(); var urlParams = generateUrlParams(); var urlPage = urlParams['urlPage']; var urlLimit = urlParams['urlLimit']; var urlOrder = urlParams['urlOrder']; var maxPageLimit = urlParams['maxPageLimit']; var maxPageLimit = urlParams['maxPageLimit']; var insideUri = urlParams['insideUri']; var page = 1; var limit = 10; if(urlPage) { page = urlPage; } if(!urlPage) { urlPage = 1; } if(urlLimit) { limit = urlLimit; } if(!urlOrder) { urlOrder = "asc"; } if(page > maxPageLimit) { page = maxPageLimit; } $('#ajax-pagination').show(); getData(insideUri, limit, page, urlOrder); createNewUrl(page, limit, urlOrder); $(".loader-div").hide(); $('#actualPageSpan').val(page); //to skip the jump to top function return false; }); $(document ).delegate( "#limit-sel", "change", function(e) { e.preventDefault(); var limit = this.value; var urlParams = generateUrlParams(); var urlPage = urlParams['urlPage']; var urlLimit = urlParams['urlLimit']; var urlOrder = urlParams['urlOrder']; var maxPageLimit = urlParams['maxPageLimit']; var maxPage = urlParams['maxPage']; var insideUri = urlParams['insideUri']; $(".loader-div").show(); if( maxPage > 0) { maxPageLimit = Math.ceil(maxPage / limit); if( urlPage > maxPageLimit) { urlPage = maxPageLimit; } } getData(insideUri, limit, urlPage, urlOrder); createNewUrl(urlPage, limit,urlOrder); $(".loader-div").hide(); $('#actualPageSpan').val(urlPage); return false; }); $(document ).delegate( "#orderby", "change", function(e) { e.preventDefault(); $(".loader-div").show(); var urlParams = generateUrlParams(); var urlPage = urlParams['urlPage']; var urlLimit = urlParams['urlLimit']; var urlOrder = urlParams['urlOrder']; var maxPageLimit = urlParams['maxPageLimit']; var insideUri = urlParams['insideUri']; var orderBy = this.value; if(urlPage > maxPageLimit) { urlPage = maxPageLimit; } getData(insideUri, urlLimit, urlPage, orderBy); createNewUrl(urlPage, urlLimit, orderBy ); $(".loader-div").hide(); return false; }); $(document ).delegate( "#prev-btn", "click", function(e) { e.preventDefault(); $(".loader-div").show(); var urlParams = generateUrlParams(); var urlPage = urlParams['urlPage']; var urlLimit = urlParams['urlLimit']; var urlOrder = urlParams['urlOrder']; var maxPageLimit = urlParams['maxPageLimit']; var insideUri = urlParams['insideUri']; if(urlPage == 1){ $(".loader-div").hide(); return false; } urlPage = urlPage - 1; if(urlPage < 1){ urlPage = 1; } getData(insideUri, urlLimit, urlPage, urlOrder); $('#actualPageSpan').html(urlPage); createNewUrl(urlPage, urlLimit, urlOrder ); $(".loader-div").hide(); //to skip the jump to top function return false; }); $(document ).delegate( "#last-btn", "click", function(e) { e.preventDefault(); $(".loader-div").show(); var urlParams = generateUrlParams(); var urlPage = urlParams['urlPage']; var urlLimit = urlParams['urlLimit']; var urlOrder = urlParams['urlOrder']; var maxPageLimit = urlParams['maxPageLimit']; var maxPage = urlParams['maxPage']; var insideUri = urlParams['insideUri']; urlPage = maxPageLimit; getData(insideUri, urlLimit, urlPage, urlOrder); $('#actualPageSpan').html(urlPage); createNewUrl(urlPage, urlLimit, urlOrder); $(".loader-div").hide(); //to skip the jump to top function return false; }); $(document ).delegate( "#first-btn", "click", function(e) { e.preventDefault(); $(".loader-div").show(); var urlParams = generateUrlParams(); var urlPage = urlParams['urlPage']; var urlLimit = urlParams['urlLimit']; var urlOrder = urlParams['urlOrder']; var maxPageLimit = urlParams['maxPageLimit']; var insideUri = urlParams['insideUri']; urlPage = 1; getData(insideUri, urlLimit, urlPage, urlOrder); $('#actualPageSpan').html(urlPage); createNewUrl(urlPage, urlLimit, urlOrder); $(".loader-div").hide(); //to skip the jump to top function return false; }); $(document ).delegate( "#next-btn", "click", function(e) { $(".loader-div").show(); e.preventDefault(); var urlParams = generateUrlParams(); var urlPage = urlParams['urlPage']; var urlLimit = urlParams['urlLimit']; var urlOrder = urlParams['urlOrder']; var maxPageLimit = urlParams['maxPageLimit']; var insideUri = urlParams['insideUri']; if ($(this).hasClass('disabled')){ $(".loader-div").hide(); return false; } if(maxPageLimit == parseInt(urlPage) + 1){ urlPage = parseInt(urlPage) + 1; $( "#next-btn" ).addClass('disabled'); getData(insideUri, urlLimit, urlPage, urlOrder); }else if (maxPageLimit == urlPage) { $( "#next-btn" ).addClass('disabled'); $(".loader-div").hide(); return false; }else { $( "#next-btn" ).removeClass('disabled'); urlPage = parseInt(urlPage) + 1; getData(insideUri, urlLimit, urlPage, urlOrder); } $('#actualPageSpan').html(urlPage); createNewUrl(urlPage, urlLimit, urlOrder); $(".loader-div").delay(2000).fadeOut("fast"); $(".loader-div").hide(); //to skip the jump to top function return false; }); /* PAGINATION END */ /* SWITCH LIST OR TREE START */ $(document ).delegate( ".res-act-button-treeview", "click", function(e) { if ($(this).hasClass('basic')) { console.log("tree view begin"); $('.children-overview-basic').hide(); $('.child-ajax-pagination').hide(); $('.children-overview-tree').fadeIn(200); $(this).removeClass('basic'); $(this).addClass('tree'); $(this).children('span').text('Switch to List-View'); //get the data var url = $('#insideUri').val(); if(url){ $('#collectionBrowser') .jstree({ core : { 'check_callback': false, data : { "url" : '/browser/get_collection_data/'+url, "dataType" : "json" }, themes : { stripes : true }, error : function (jqXHR, textStatus, errorThrown) { $('#collectionBrowser').html("<h3>Error: </h3><p>" + jqXHR.reason +"</p>"); } }, search: { case_sensitive: false, show_only_matches: true }, plugins : [ 'search' ] }); $('#collectionBrowser') //handle the node clicking to download the file .bind("click.jstree", function (node, data) { if(node.originalEvent.target.id) { var node = $('#collectionBrowser').jstree(true).get_node(node.originalEvent.target.id); if(node.original.encodedUri){ window.location.href = "/browser/oeaw_detail/"+node.original.encodedUri; } } }); } } else { $('.children-overview-tree').hide(); $('.child-ajax-pagination').fadeIn(200); $('.children-overview-basic').fadeIn(200); $(this).removeClass('tree'); $(this).addClass('basic'); $(this).children('span').text('Switch to Tree-View'); } }); /* SWITCH LIST OR TREE END */ $(".loader-div").hide(); } }; })(jQuery, Drupal);
acdh-oeaw/repo-gui
js/detailview-functions.js
JavaScript
gpl-2.0
17,608
/** * earthFrameView.js includes all the logic for the earth frame view and works in conjuction with * the earthFrameView.html page to render a 3D map that and objects on that map. * Copyright (C) 2017 Jeff Patterson, Amanda Murphy, Paolo Villanueva, Patrick Overton, Connor Picken, Yun Cong Chen, Seth Amundsen * Michael Ohl, Mathew Tighe * * This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either vesion 2 of the License, or (at our option) any later version. * * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY of FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. * * ALL RIGHTS RESERVED * This program is licensed under the "GNU General Public License" * Please see the file COPYING in the source * distribution of this software for license terms. */ "use strict" app.directive("earthFrameView", function() { return { restrict: "E", scope: {}, controller: ['$scope', 'config', function earthFrameViewController($scope, config) { // Radius of recovery crew $scope.radius = config.recoveryCrewSize; $scope.recoveryCrews = {}; // the array of longitude, latitude and altitude points sent in from the back-end var trajectoryPoints = []; // The point on the ground under the rocket var groundPos = Cesium.Cartesian3.fromDegrees(config.launchLocation.longitude, config.launchLocation.latitude); // Initializes the Cesium Viewer, positions the camera, and adds entities $scope.init = function () { // Create the viewer if (config.offline) { $scope.viewer = new Cesium.Viewer('cesiumContainer', { imageryProvider : new Cesium.createTileMapServiceImageryProvider({ url : Cesium.buildModuleUrl('Assets/Textures/NaturalEarthII'), }), baseLayerPicker: false, // disables menu to choose map type homeButton: false, // disables home button timeline: false, // disables timeline animation: false, // disables clock fullscreenButton: false, // fullscreen doesn't work correctly geocoder: false, // disables landmark detection selectionIndicator: false, // disables indicator on selected object sceneModePicker: false // disables default scene picker }); } else { $scope.viewer = new Cesium.Viewer('cesiumContainer', { baseLayerPicker: false, // disables menu to choose map type homeButton: false, // disables home button timeline: false, // disables timeline animation: false, // disables clock fullscreenButton: false, // fullscreen doesn't work correctly geocoder: false, // disables landmark detection selectionIndicator: false, // disables indicator on selected object sceneModePicker: false // disables default scene picker }); } // Add terain to the cesium map if configuration is set to true. if (config.cesiumTerrain) { $scope.viewer.terrainProvider = new Cesium.CesiumTerrainProvider({ url : 'https://assets.agi.com/stk-terrain/world', requestWaterMask : true, requestVertexNormals : true }); } // Activate directional lighting for terrain if configuration is set to true. (globe will be dark at night) if (config.cesiumRTLighting) { $scope.viewer.scene.globe.enableLighting = true; } // Set Initial Rocket Position $scope.RocketPosition = Cesium.Cartesian3.fromDegrees(config.launchLocation.longitude, config.launchLocation.latitude, config.launchLocation.altitude); if (config.cesiumRocket) { // Use a model for the rocket $scope.rocket = $scope.viewer.entities.add({ name : 'Rocket', position: $scope.RocketPosition, model : { uri : 'assets/rocket.gltf', color : Cesium.Color.BLUE, minimumPixelSize : config.rocketSize, maximumScale : config.rocketScale, colorBlendAmount : 1.0 } }); } else { // Make a dot for the rocket $scope.rocket = $scope.viewer.entities.add({ name : 'Rocket', position: $scope.RocketPosition, ellipsoid : { radii : new Cesium.Cartesian3(300.0, 300.0, 300.0), material : Cesium.Color.BLUE, outline : false } }); } $scope.viewer.trackedEntity = $scope.rocket; // Positions the camera so that all entities are in view $scope.viewer.zoomTo($scope.viewer.entities); // Or... Position the camera gradually with flyTo // $scope.viewer.camera.flyTo({ // destination: new Cesium.Cartesian3.fromDegrees(config.launchLocation.longitude, config.launchLocation.latitude, config.launchLocation.altitude) // }); // Gets rid of a developer tools error and allows cesium to work $scope.viewer.infoBox.frame.sandbox = "allow-same-origin allow-top-navigation allow-pointer-lock allow-popups allow-forms allow-scripts"; // The projected trajectory of the rocket. $scope.projTraj = $scope.viewer.entities.add({ name : "Projected Trajectory", polyline : { positions : [$scope.RocketPosition, groundPos], width : 3, material : Cesium.Color.WHITE } }); }; // Adds Recovery Crew Dots to globe var addDotForRecoveryCrew = function(callsign, lat, longi) { var recoveryCrew = $scope.viewer.entities.add({ name : callsign, position: Cesium.Cartesian3.fromDegrees(longi, lat), point : { pixelSize : 25, color : Cesium.Color.GREEN, outlineColor : Cesium.Color.WHITE, outlineWidth : 2 }, label : { text : callsign, font : '14pt monospace', style: Cesium.LabelStyle.FILL_AND_OUTLINE, outlineWidth : 2, verticalOrigin : Cesium.VerticalOrigin.BOTTOM, pixelOffset : new Cesium.Cartesian2(0, -9) } }); $scope.recoveryCrews[callsign] = recoveryCrew; } // Move recovery crew $scope.movePoints = function(callsign, lat, longi) { $scope.recoveryCrews[callsign].position = Cesium.Cartesian3.fromDegrees(longi, lat); }; // helper function, used to update the rockets position $scope.moveRocket = function(x, y, z) { // Update the start positions of the projected trajectory line groundPos = Cesium.Cartesian3.fromDegrees(x, y); // add a new point to the list of points for the line that creates the actual trajectory trajectoryPoints = trajectoryPoints.concat([x, y, z]); // store the new position in a variable //$scope.RocketPosition = Cesium.Cartesian3.fromDegrees(x, y, z); // move the rocket to new position $scope.rocket.position = $scope.RocketPosition; // Declare the trajectory line var actualTrajectory = $scope.viewer.entities.add({ name : 'Actual Trajectory', polyline : { positions : Cesium.Cartesian3.fromDegreesArrayHeights(trajectoryPoints), width : 5, material : new Cesium.PolylineOutlineMaterialProperty({ color : Cesium.Color.RED, // make the line red }) } }); var rocketPos = Cesium.Cartesian3.fromDegrees(x, y, z); $scope.projTraj.polyline.positions = [rocketPos, groundPos]; //only adds the newest point to the map to avoid overflow if(trajectoryPoints.length == 2) { trajectoryPoints.split(1, 1); } } // Changes the camera location and tilt when a new item is selected in the efv // camera drop down menu $scope.changeCameraView = function() { var viewKey = $scope.selected; switch(viewKey) { case 'side': var offset = new Cesium.Cartesian3(70642.66030209465, -31661.517948317807, 35505.179997143336); $scope.viewer.camera.lookAt($scope.RocketPosition, offset); break; case 'top': $scope.viewer.zoomTo($scope.viewer.entities); break; } }; $scope.selected = 'default'; // Initialize Cesium $scope.init(); // Reset Cesium Viewer $scope.reset = function () { $scope.viewer.destroy(); console.log("Cesium Reset"); if ($scope.viewer.isDestroyed()) { $scope.init(); } } var namespace = '/main'; // this port connects to port broadcast by ../unified/app.py var socket = io.connect('http://' + config.serverSource + ':8080' + namespace); socket.on('connect', function() {}); socket.on('disconnect', function() {}); socket.on('telemetry', function(data) { for(var key in data) { if(key == config.V8A8) { //update anything that uses V8A8 data in cesium $scope.RocketPosition = Cesium.Cartesian3.fromDegrees(data[key][config.Longitude], data[key][config.Latitude], data[key][config.MSL_Altitude]); $scope.moveRocket(data[key][config.Longitude], data[key][config.Latitude], data[key][config.MSL_Altitude]); } } }); socket.on('recovery', function(data) { console.log(data); var callsign = data[config.Callsign]; var lat = data[config.Latitude]; var longi = data[config.Longitude]; if(!$scope.recoveryCrews.hasOwnProperty(callsign)) { addDotForRecoveryCrew(callsign, lat, longi); } else { $scope.movePoints(callsign, lat, longi); } }); }], templateUrl: 'directives/earthFrameView.html' } });
patter5/rv3k
front-end/app/directives/earthFrameView.js
JavaScript
gpl-2.0
12,278
var searchData= [ ['marker_2ecpp',['marker.cpp',['../marker_8cpp.html',1,'']]], ['marker_2eh',['marker.h',['../marker_8h.html',1,'']]], ['mempool_2eh',['mempool.h',['../mempool_8h.html',1,'']]] ];
gpgreen/ShipCAD
doc/html/search/files_7.js
JavaScript
gpl-2.0
203
(function () { describe('escapeHTML tests', function () { context('ignores safe patterns', function () { context(null, function () { var good = 'var a = "escapeHTML";'; it(good, function () { chai.expect(ScanJS.scan(good, "/tests/")).to.be.empty; }); }); context(null, function () { var good = 'var escapeHTML = "just a string";'; it(good, function () { chai.expect(ScanJS.scan(good, "/tests/")).to.be.empty; }); }); }); context('detects dangerous patterns', function () { context(null, function () { var bad = 'var nodeName = escapeHTML(node.name);'; it(bad, function () { chai.expect(ScanJS.scan(bad, "/tests/")).not.to.be.empty; }); }); }); }); })();
dpnishant/raptor
backend/scanjs/tests/cases/escapeHTML.js
JavaScript
gpl-2.0
812
(function($) { "use strict"; $(document).ready(function() { var _tm_check_for_changes = 0; var tm_epo_sortable_options = { items: '.woocommerce_tm_epo', cursor: 'move', axis: 'y', handle: 'h3', scrollSensitivity: 40, forcePlaceholderSize: true, helper: 'clone', opacity: 0.65, placeholder: 'wc-metabox-sortable-placeholder', start: function(event, ui) { ui.item.css('background-color', '#f6f6f6'); }, stop: function(event, ui) { ui.item.removeAttr('style'); tm_epo_row_indexes(); } }; /** * Update boxes */ function tm_epo_update_boxes() { jQuery('.woocommerce_tm_epo').each(function(index, element) { var _root = jQuery(element); var _current_att = _root.find('.tmcp_attribute').val(); _root.find('select.tmcp_att').hide(); _root.find("select.tmcp_att[data-tm-attr='" + _current_att + "']" ).show(); var attribute = _root.find('select.tmcp_att').val(); var variation = _root.find('select.tmcp-variation').val(); var show_field = "input.tmcp-price-input-variation-" + variation+"[data-price-input-attribute='" + attribute + "'],select.tmcp-price-input-variation-" + variation+"[data-price-input-attribute='" + attribute + "']"; _root.find("input.tmcp-price-input").hide(); _root.find("select.tmcp-price-input-type").hide(); _root.find(show_field).show(); tm_epo_show_price_field(_root.find('select.tmcp-variation'), "variation"); }); // trigger woocommerce hide classes function jQuery('input#_downloadable').trigger('change'); } tm_epo_update_boxes(); function tm_epo_show_price_field(obj, what) { var val = obj.val(); var _root = obj.closest('.woocommerce_tm_epo'); _root.find("input.tmcp-price-input").hide(); _root.find("select.tmcp-price-input-type").hide(); var loop = _root.find('input.tmcp_loop').val(); var attribute = _root.find('select.tmcp_att').val(); var variation = _root.find('select.tmcp-variation').val(); var show_field = ""; switch (what) { case "variation": variation = val; show_field = "input.tmcp-price-input-variation-" + val + "[data-price-input-attribute='" + attribute + "'],select.tmcp-price-input-variation-" + val + "[data-price-input-attribute='" + attribute + "']"; break; case "attribute": attribute = val; show_field = "input.tmcp-price-input-variation-" + variation+"[data-price-input-attribute='" + val + "'],select.tmcp-price-input-variation-" + variation+"[data-price-input-attribute='" + val + "']"; break; } if (_root.find(show_field).length <= 0) { _root.find(".tmcp_pricing td").append('<input type="text" size="5" name="tmcp_regular_price[' + loop + '][' + attribute + '][' + variation + ']" value="" class="wc_input_price tmcp-price-input tmcp-price-input-variation-' + variation + '" data-price-input-attribute="'+attribute+'" />'); _root.find(".tmcp_pricing td").append('<select class="tmcp-price-input-type tmcp-price-input tmcp-price-input-variation-' + variation + '" data-price-input-attribute="'+attribute+'" name="tmcp_regular_price_type[' + loop + '][' + attribute + '][' + variation + ']"><option value="">'+tm_epo_admin_meta_boxes.i18n_fixed_type+'</option><option value="percent">'+tm_epo_admin_meta_boxes.i18n_percent_type+'</option></select>'); } _root.find(show_field).show(); } $('#tm_extra_product_options').on('change', 'select.tmcp-variation', function(e) { tm_epo_show_price_field($(this), "variation"); }); $('#tm_extra_product_options').on('change', 'select.tmcp_att', function(e) { tm_epo_show_price_field($(this), "attribute"); }); /** * Set Ordering */ $('#tm_extra_product_options').on('woocommerce_tm_epo_added', function() { $('.woocommerce_tm_epos').sortable(tm_epo_sortable_options); }); $('#tm_extra_product_options').on('woocommerce_tm_epos_loaded', function() { $('.woocommerce_tm_epos').sortable(tm_epo_sortable_options); }); function tm_epo_row_indexes() { $('.woocommerce_tm_epos .woocommerce_tm_epo').each(function(index, el) { $('.tm_epo_menu_order', el).val(parseInt($(el).index('.woocommerce_tm_epos .woocommerce_tm_epo'), 10)); }); } $('.woocommerce_tm_epos').sortable(tm_epo_sortable_options); /* * Add custom check handlers */ function tm_epo_check() { if (_tm_check_for_changes == 1) { $('#tm_extra_product_options').block({ message: null, overlayCSS: { background: '#fff url(' + tm_epo_admin_meta_boxes.plugin_url + '/assets/images/ajax-loader.gif) no-repeat center', opacity: 0.6 } }); var data = { action: 'woocommerce_tm_load_epos', post_id: tm_epo_admin_meta_boxes.post_id, security: tm_epo_admin_meta_boxes.load_tm_epo_nonce }; $.post(tm_epo_admin_meta_boxes.ajax_url, data, function(response) { $('.tm_mode_local').html(response); $('#tm_extra_product_options').unblock(); $('#tm_extra_product_options').trigger('woocommerce_tm_epos_loaded'); _tm_check_for_changes = 0; tm_epo_update_boxes(); }); } } $('#variable_product_options').on('click', 'button.remove_variation', function(e) { _tm_check_for_changes = 1; }); $('#variable_product_options').on('woocommerce_variations_added', function() { _tm_check_for_changes = 1; }); $('.product_attributes').on('click', 'button.add_new_attribute', function() { _tm_check_for_changes = 1; }); $('.save_attributes').on('click', function() { _tm_check_for_changes = 1; }); $('.tm_epo_class a').on('click', function() { tm_epo_check(); }); /* * Add extra option */ $('#tm_extra_product_options').on('click', 'button.tm_add_epo', function() { var attribute_type = $('select.tmcp_attr_list').val(), thisrow; try{ thisrow= $(".woocommerce_tm_epos .woocommerce_tm_epo[data-epo-attr='" + attribute_type + "']"); }catch(err){ thisrow=$(); } if (thisrow.length > 0) { thisrow.find('.woocommerce_tmcp_attributes').show(); return; } $('.tm_mode_local').block({ message: null, overlayCSS: { background: '#fff url(' + tm_epo_admin_meta_boxes.plugin_url + '/assets/images/ajax-loader.gif) no-repeat center', opacity: 0.6 } }); var loop = $('.woocommerce_tm_epo').length; var data = { action: 'woocommerce_tm_add_epo', post_id: tm_epo_admin_meta_boxes.post_id, att_id: attribute_type, loop: loop, security: tm_epo_admin_meta_boxes.add_tm_epo_nonce }; $.post(tm_epo_admin_meta_boxes.ajax_url, data, function(response) { if (response == 'max') { alert(tm_epo_admin_meta_boxes.i18n_max_tmcp); $('.tm_mode_local').unblock(); } else { $('.woocommerce_tm_epos').append(response); $('.tm_mode_local').unblock(); $('#tm_extra_product_options').trigger('woocommerce_tm_epo_added'); tm_epo_update_boxes(); } }); return false; }); /* * Remove extra option */ $('#tm_extra_product_options').on('click', 'button.remove_tm_epo', function(e) { e.preventDefault(); var answer = window.confirm(tm_epo_admin_meta_boxes.i18n_remove_tmcp); if (answer) { var el = $(this).parent().parent(); var variation = $(this).attr('rel'); if (variation > 0) { $(el).block({ message: null, overlayCSS: { background: '#fff url(' + tm_epo_admin_meta_boxes.plugin_url + '/assets/images/ajax-loader.gif) no-repeat center', opacity: 0.6 } }); var data = { action: 'woocommerce_tm_remove_epo', tmcpid: variation, security: tm_epo_admin_meta_boxes.delete_tm_epo_nonce }; $.post(tm_epo_admin_meta_boxes.ajax_url, data, function(response) { // Success $(el).fadeOut('300', function() { $(el).remove(); }); }); } else { $(el).fadeOut('300', function() { $(el).remove(); }); } } return false; }); /* * Mode Selector */ function tm_set_mode(mode){ if (!mode){ return; } $('#tm_meta_cpf_mode').val(mode) $(".tm_mode_selector").addClass("tm_hidden"); $(".tm_mode_builder,.tm_mode_local").hide(); $(".tm_mode_"+mode).show(); $(".tm_builder_select,.tm_local_select").removeClass("button-primary"); $(".tm_"+mode+"_select").addClass("button-primary"); } $('#tm_extra_product_options').on('click', '.tm_select_mode', function(e) { e.preventDefault(); var mode="local"; if ($(this).is(".tm_builder_select")){ mode="builder"; } tm_set_mode(mode); }); tm_set_mode($('#tm_meta_cpf_mode').val()); }); })(jQuery);
deewilcox/soul-serenades
wp-content/plugins/woocommerce-tm-extra-product-options/assets/js/admin/tm-epo-admin.js
JavaScript
gpl-2.0
11,304
function AlertBox(headline, message, confirmable) { this.headline = headline; this.message = message; this.confirmable = confirmable; } AlertBox.prototype.spawn = function() { if (this.confirmable === true) { this.button = '<button class="btn btn-primary" id="form-confirm" onclick="'+this.discard; /*$(this).find('button').on('click', function() { this.discard(); });*/ } else { this.button = ''; } var html = '<div class="alertBox">' + '<h1>' + this.headline + '</h1>' + '<p>' + this.message + '</p>' + this.button + '</div>' $('body').append(html); } AlertBox.prototype.discard = function() { $('body .alertBox').fadeOut(250); setTimeout(function () { $('body .alertBox').remove(); }, 300); } function Form(element) { var self = this; this.element = element[0]; this.init(); this.element.addEventListener('submit', function(event) { self.handle(event); }); }; Form.prototype.init = function() { this.referencing = $(this.element).attr('referencing'); this.request = $(this.element).attr('request'); this.confirmable = $(this.element).attr('confirmable'); this.redirect = $(this.element).attr('redirect'); this.urlParams = [this.referencing, this.request]; }; Form.prototype.validate = function() { var valid = true; $(this.element).find('.required').each(function (index, value) { if ($.trim($(value).val()).length === 0) { $(value).parent().parent().addClass("has-error"); valid = false; } else { $(value).parent().removeClass("error"); valid = true; } }); return valid; }; Form.prototype.serialize = function() { return $(this.element).serialize(); }; Form.prototype.handle = function(event) { event.preventDefault(); if(this.validate()) { this.triggerRequest(); } else { throw new Error('form not valid') } }; Form.prototype.handleRedirect = function(response) { var itemIdentifier = this.redirect.match("{(.*)}")[1]; var url = this.redirect.split('/'); url[url.length - 1] = response[itemIdentifier]; this.urlParams = url; window.location.href = this.urlParser(); }; Form.prototype.triggerRequest = function() { $.post(this.urlParser(), this.serialize()).done((function(data) { var parsedResponse = JSON.parse(data); if(parsedResponse.success) { if(this.redirect !== 'self') { this.handleRedirect(parsedResponse); } else { window.location.reload(); } } }).bind(this)); }; Form.prototype.urlParser = function() { return location.protocol + '//' + location.hostname + ':' + location.port + this.urlParams.join('/'); } function scrollTo(element) { var scroll = $(element).offset().top; $('html, body').animate({ scrollTop: scroll }, 'slow'); } function toggleAnswer(e) { e.preventDefault(); $('.answer').fadeToggle(500); scrollTo($('.answer')); $('.answer-anchor').fadeToggle(); $('#answer').focus(); } $(document).ready(function () { $.ajaxSetup({ headers: { 'X-CSRF-Token': $('meta[name="_token"]').attr('content') } }); $('.answer-anchor').on('click', function () { $('.answer').fadeIn(500); scrollTo($('.answer')); $('.answer-anchor').fadeOut(); }); $('[ajax-form]').each(function() { new Form($(this)); }) $('.answerbox').on('keypress', function (e) { if (e.which === 13 && e.shiftKey) { $(this).parent().submit(); e.preventDefault(); } }) $(document).on('keydown', function (e) { var forbiddenTags = ['input', 'textarea']; if (forbiddenTags.indexOf(e.target.tagName.toLowerCase()) === -1 && e.which === 82 && e.shiftKey) { toggleAnswer(e); } }); $('button[href]').on('click', function() { var url = $(this).attr('href'); window.location.href = url; }); });
kaeku/webfolks
public/js/app.js
JavaScript
gpl-2.0
3,832
/** The minplayer namespace. */ var minplayer = minplayer || {}; /** All the media player implementations */ minplayer.players = minplayer.players || {}; /** * @constructor * @extends minplayer.players.base * @class The vimeo media player. * * @param {object} context The jQuery context. * @param {object} options This components options. * @param {object} queue The event queue to pass events around. */ minplayer.players.vimeo = function(context, options, queue) { // Derive from players base. minplayer.players.base.call(this, context, options, queue); }; /** Derive from minplayer.players.base. */ minplayer.players.vimeo.prototype = new minplayer.players.base(); /** Reset the constructor. */ minplayer.players.vimeo.prototype.constructor = minplayer.players.vimeo; /** * @see minplayer.plugin.construct * @this minplayer.players.vimeo */ minplayer.players.vimeo.prototype.construct = function() { // Call the players.flash constructor. minplayer.players.base.prototype.construct.call(this); // Set the plugin name within the options. this.options.pluginName = 'vimeo'; }; /** * @see minplayer.players.base#getPriority * @return {number} The priority of this media player. */ minplayer.players.vimeo.getPriority = function() { return 10; }; /** * @see minplayer.players.base#canPlay * @return {boolean} If this player can play this media type. */ minplayer.players.vimeo.canPlay = function(file) { // Check for the mimetype for vimeo. if (file.mimetype === 'video/vimeo') { return true; } // If the path is a vimeo path, then return true. return (file.path.search(/^http(s)?\:\/\/(www\.)?vimeo\.com/i) === 0); }; /** * Determines if the player should show the playloader. * * @return {bool} If this player implements its own playLoader. */ minplayer.players.vimeo.prototype.hasPlayLoader = function() { return minplayer.hasTouch; }; /** * Determines if the player should show the playloader. * * @return {bool} If this player implements its own playLoader. */ minplayer.players.vimeo.prototype.hasController = function() { return minplayer.hasTouch; }; /** * Return the ID for a provided media file. * * @param {object} file A {@link minplayer.file} object. * @return {string} The ID for the provided media. */ minplayer.players.vimeo.getMediaId = function(file) { var regex = /^http[s]?\:\/\/(www\.)?vimeo\.com\/(\?v\=)?([0-9]+)/i; if (file.path.search(regex) === 0) { return file.path.match(regex)[3]; } else { return file.path; } }; /** * @see minplayer.players.base#reset */ minplayer.players.vimeo.prototype.reset = function() { // Reset the flash variables.. minplayer.players.base.prototype.reset.call(this); }; /** * @see minplayer.players.base#create * @return {object} The media player entity. */ minplayer.players.vimeo.prototype.create = function() { minplayer.players.base.prototype.create.call(this); // Insert the Vimeo Froogaloop player. var tag = document.createElement('script'); tag.src = 'http://a.vimeocdn.com/js/froogaloop2.min.js'; var firstScriptTag = document.getElementsByTagName('script')[0]; firstScriptTag.parentNode.insertBefore(tag, firstScriptTag); // Create the iframe for this player. var iframe = document.createElement('iframe'); iframe.setAttribute('id', this.options.id + '-player'); iframe.setAttribute('type', 'text/html'); iframe.setAttribute('width', '100%'); iframe.setAttribute('height', '100%'); iframe.setAttribute('frameborder', '0'); jQuery(iframe).addClass('vimeo-player'); // Get the source. var src = 'http://player.vimeo.com/video/'; src += this.mediaFile.id + '?'; // Add the parameters to the src. src += jQuery.param({ 'wmode': 'opaque', 'api': 1, 'player_id': this.options.id + '-player', 'title': 0, 'byline': 0, 'portrait': 0, 'autoplay': this.options.autoplay, 'loop': this.options.loop }); // Set the source of the iframe. iframe.setAttribute('src', src); // Now register this player when the froogaloop code is loaded. this.poll((function(player) { return function() { if (window.Froogaloop) { player.player = window.Froogaloop(iframe); var playerTimeout = 0; player.player.addEvent('ready', function() { clearTimeout(playerTimeout); player.onReady(); player.onError(''); }); playerTimeout = setTimeout(function() { player.onReady(); player.onError('Unable to play video.'); }, 2000); } return !window.Froogaloop; }; })(this), 200); // Trigger that the load has started. this.trigger('loadstart'); // Return the player. return iframe; }; /** * @see minplayer.players.base#onReady */ minplayer.players.vimeo.prototype.onReady = function(player_id) { // Add the other listeners. this.player.addEvent('loadProgress', (function(player) { return function(progress) { player.duration.set(parseFloat(progress.duration)); player.bytesLoaded.set(progress.bytesLoaded); player.bytesTotal.set(progress.bytesTotal); }; })(this)); this.player.addEvent('playProgress', (function(player) { return function(progress) { player.duration.set(parseFloat(progress.duration)); player.currentTime.set(parseFloat(progress.seconds)); }; })(this)); this.player.addEvent('play', (function(player) { return function() { player.onPlaying(); }; })(this)); this.player.addEvent('pause', (function(player) { return function() { player.onPaused(); }; })(this)); this.player.addEvent('finish', (function(player) { return function() { player.onComplete(); }; })(this)); minplayer.players.base.prototype.onReady.call(this); this.onLoaded(); }; /** * Clears the media player. */ minplayer.players.vimeo.prototype.clear = function() { if (this.player) { this.player.api('unload'); } minplayer.players.base.prototype.clear.call(this); }; /** * @see minplayer.players.base#load * @return {boolean} If this action was performed. */ minplayer.players.vimeo.prototype.load = function(file) { if (minplayer.players.base.prototype.load.call(this, file)) { this.construct(); return true; } return false; }; /** * @see minplayer.players.base#play * @return {boolean} If this action was performed. */ minplayer.players.vimeo.prototype.play = function() { if (minplayer.players.base.prototype.play.call(this)) { this.player.api('play'); return true; } return false; }; /** * @see minplayer.players.base#pause * @return {boolean} If this action was performed. */ minplayer.players.vimeo.prototype.pause = function() { if (minplayer.players.base.prototype.pause.call(this)) { this.player.api('pause'); return true; } return false; }; /** * @see minplayer.players.base#stop * @return {boolean} If this action was performed. */ minplayer.players.vimeo.prototype.stop = function() { if (minplayer.players.base.prototype.stop.call(this)) { this.player.api('unload'); return true; } return false; }; /** * @see minplayer.players.base#seek * @return {boolean} If this action was performed. */ minplayer.players.vimeo.prototype.seek = function(pos) { if (minplayer.players.base.prototype.seek.call(this, pos)) { this.player.api('seekTo', pos); return true; } return false; }; /** * @see minplayer.players.base#setVolume * @return {boolean} If this action was performed. */ minplayer.players.vimeo.prototype.setVolume = function(vol) { if (minplayer.players.base.prototype.setVolume.call(this, vol)) { this.volume.set(vol); this.player.api('setVolume', vol); return true; } return false; }; /** * @see minplayer.players.base#getVolume */ minplayer.players.vimeo.prototype.getVolume = function(callback) { this.player.api('getVolume', function(vol) { callback(vol); }); }; /** * @see minplayer.players.base#getDuration. */ minplayer.players.vimeo.prototype.getDuration = function(callback) { if (this.isReady()) { if (this.duration.value) { callback(this.duration.value); } else { this.player.api('getDuration', function(duration) { callback(duration); }); } } };
mediahackers/ubeauty
sites/all/modules/mediafront/players/osmplayer/player/minplayer/src/minplayer.players.vimeo.js
JavaScript
gpl-2.0
8,312