mirror of
https://github.com/overte-org/overte.git
synced 2025-06-05 18:30:59 +02:00
Add missing files required for local running of the script.
This commit is contained in:
parent
4c6be03865
commit
aa2ec12d8d
9 changed files with 721 additions and 2 deletions
177
scripts/communityScripts/decentralizedGoTo/addLocation.html
Normal file
177
scripts/communityScripts/decentralizedGoTo/addLocation.html
Normal file
|
@ -0,0 +1,177 @@
|
||||||
|
<!--
|
||||||
|
// addLocation.html
|
||||||
|
//
|
||||||
|
// Created by Darlingnotin in 2019.
|
||||||
|
// Copyright 2019 Darlingnotin
|
||||||
|
//
|
||||||
|
// Distributed under the ISC license.
|
||||||
|
// See the accompanying file LICENSE or https://opensource.org/licenses/ISC
|
||||||
|
-->
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
|
||||||
|
<head>
|
||||||
|
<title>GoTo Decentral</title>
|
||||||
|
<link href="bootstrap.min.css" rel="stylesheet">
|
||||||
|
<style>
|
||||||
|
.myButton {
|
||||||
|
box-shadow: 3px 4px 0px 0px #899599;
|
||||||
|
background: linear-gradient(to bottom, #ededed 5%, #bab1ba 100%);
|
||||||
|
background-color: #ededed;
|
||||||
|
border-radius: 15px;
|
||||||
|
border: 1px solid #d6bcd6;
|
||||||
|
display: inline-block;
|
||||||
|
cursor: pointer;
|
||||||
|
color: #3a8a9e;
|
||||||
|
font-family: Arial;
|
||||||
|
font-size: 17px;
|
||||||
|
padding: 2px 19px;
|
||||||
|
text-decoration: none;
|
||||||
|
text-shadow: 0px 1px 0px #e1e2ed;
|
||||||
|
}
|
||||||
|
|
||||||
|
.myButton:hover {
|
||||||
|
background: linear-gradient(to bottom, #bab1ba 5%, #ededed 100%);
|
||||||
|
background-color: #bab1ba;
|
||||||
|
}
|
||||||
|
|
||||||
|
.myButton:active {
|
||||||
|
position: relative;
|
||||||
|
top: 1px;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
.myButtonB {
|
||||||
|
box-shadow: 3px 4px 0px 0px #899599;
|
||||||
|
background: linear-gradient(to bottom, #ededed 5%, #bab1ba 100%);
|
||||||
|
background-color: #ededed;
|
||||||
|
border-radius: 15px;
|
||||||
|
border: 1px solid #d6bcd6;
|
||||||
|
display: inline-block;
|
||||||
|
cursor: pointer;
|
||||||
|
color: #3a8a9e;
|
||||||
|
font-family: Arial;
|
||||||
|
font-size: 17px;
|
||||||
|
padding: 2px 19px;
|
||||||
|
text-decoration: none;
|
||||||
|
text-shadow: 0px 1px 0px #e1e2ed;
|
||||||
|
position: absolute;
|
||||||
|
right: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.myButtonB:hover {
|
||||||
|
background: linear-gradient(to bottom, #bab1ba 5%, #ededed 100%);
|
||||||
|
background-color: #bab1ba;
|
||||||
|
}
|
||||||
|
|
||||||
|
.myButtonB:active {
|
||||||
|
position: relative;
|
||||||
|
top: 1px;
|
||||||
|
}
|
||||||
|
|
||||||
|
table {
|
||||||
|
font-family: arial, sans-serif;
|
||||||
|
border-collapse: collapse;
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
td,
|
||||||
|
th {
|
||||||
|
border: 1px solid #dddddd;
|
||||||
|
text-align: left;
|
||||||
|
padding: 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
tr:nth-child(even) {
|
||||||
|
background-color: #EFEFEF;
|
||||||
|
}
|
||||||
|
|
||||||
|
input[type=text],
|
||||||
|
select {
|
||||||
|
width: 450px;
|
||||||
|
padding: 12px 20px;
|
||||||
|
margin: 8px 0;
|
||||||
|
display: inline-block;
|
||||||
|
border: 1px solid #dddddd;
|
||||||
|
border-radius: 4px;
|
||||||
|
box-sizing: border-box;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body onload="retrieveInformation()">
|
||||||
|
|
||||||
|
<h1>Add Location</h1><br>
|
||||||
|
<h3>Metaverse Provider URL</h3>
|
||||||
|
<select id="javascriptURL">
|
||||||
|
</select>
|
||||||
|
<h3>Domain Name</h3>
|
||||||
|
<input type="text" id="domainName" placeholder="Enter Domain Name here">
|
||||||
|
<h3>Owner</h3>
|
||||||
|
<input type="text" id="owner" placeholder="Enter Owner here">
|
||||||
|
<h3>Port</h3>
|
||||||
|
<input type="text" id="port" placeholder="Enter Port here (default 40102)"><br><br>
|
||||||
|
|
||||||
|
<button class="myButton" onclick="addLocation()">Add</button>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
var retrievePortInformationResponse;
|
||||||
|
var metaverseProviderList = [];
|
||||||
|
function retrieveInformation() {
|
||||||
|
var readyEvent = {
|
||||||
|
"action": "retrievePortInformation",
|
||||||
|
};
|
||||||
|
EventBridge.emitWebEvent(JSON.stringify(readyEvent));
|
||||||
|
}
|
||||||
|
|
||||||
|
function addToSelect() {
|
||||||
|
for (let i = 0; i < metaverseProviderList.length; i++) {
|
||||||
|
var x = document.getElementById("javascriptURL");
|
||||||
|
var option = document.createElement("option");
|
||||||
|
option.text = metaverseProviderList[i];
|
||||||
|
x.add(option);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function addLocation() {
|
||||||
|
var domainName = document.getElementById("domainName").value;
|
||||||
|
if (domainName == "") {
|
||||||
|
domainName = "Enter domain name";
|
||||||
|
}
|
||||||
|
var owner = document.getElementById("owner").value;
|
||||||
|
if (owner == "") {
|
||||||
|
owner = "Enter owner of domain";
|
||||||
|
}
|
||||||
|
var port = document.getElementById("port").value;
|
||||||
|
var javascriptURL = document.getElementById("javascriptURL").value;
|
||||||
|
if (port == "") {
|
||||||
|
port = 40102;
|
||||||
|
}
|
||||||
|
var readyEvent = {
|
||||||
|
"action": "addLocation",
|
||||||
|
"domainName": domainName,
|
||||||
|
"owner": owner,
|
||||||
|
"Port": port,
|
||||||
|
"script": javascriptURL
|
||||||
|
};
|
||||||
|
EventBridge.emitWebEvent(JSON.stringify(readyEvent));
|
||||||
|
}
|
||||||
|
|
||||||
|
EventBridge.scriptEventReceived.connect(function (message) {
|
||||||
|
var messageData = JSON.parse(message);
|
||||||
|
if (messageData.action == "retrievePortInformationResponse") {
|
||||||
|
retrievePortInformationResponse = messageData.goToAddresses;
|
||||||
|
for (let i = 0; i < retrievePortInformationResponse.length; i++) {
|
||||||
|
metaverseProvider = retrievePortInformationResponse[i].split("/")[2].split(":")[0];
|
||||||
|
metaverseProviderList[metaverseProviderList.length] = "https://" + metaverseProvider + "/interim/d-goto/app/decentralizedGoToServerScript.js";
|
||||||
|
}
|
||||||
|
addToSelect();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
</script>
|
||||||
|
|
||||||
|
</bodyonload="retrieveAddressList()">
|
||||||
|
|
||||||
|
</html>
|
7
scripts/communityScripts/decentralizedGoTo/bootstrap.min.css
vendored
Normal file
7
scripts/communityScripts/decentralizedGoTo/bootstrap.min.css
vendored
Normal file
File diff suppressed because one or more lines are too long
7
scripts/communityScripts/decentralizedGoTo/bootstrap.min.js
vendored
Normal file
7
scripts/communityScripts/decentralizedGoTo/bootstrap.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
|
@ -0,0 +1,189 @@
|
||||||
|
<!--
|
||||||
|
// decentralizedGoTo.html
|
||||||
|
//
|
||||||
|
// Created by Darlingnotin in 2019.
|
||||||
|
// Copyright 2019 Darlingnotin
|
||||||
|
//
|
||||||
|
// Distributed under the ISC license.
|
||||||
|
// See the accompanying file LICENSE or https://opensource.org/licenses/ISC
|
||||||
|
-->
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
|
||||||
|
<head>
|
||||||
|
<title>GoTo Decentral</title>
|
||||||
|
<link href="bootstrap.min.css" rel="stylesheet">
|
||||||
|
<style>
|
||||||
|
.myButton {
|
||||||
|
box-shadow: 3px 4px 0px 0px #899599;
|
||||||
|
background: linear-gradient(to bottom, #ededed 5%, #bab1ba 100%);
|
||||||
|
background-color: #ededed;
|
||||||
|
border-radius: 15px;
|
||||||
|
border: 1px solid #d6bcd6;
|
||||||
|
display: inline-block;
|
||||||
|
cursor: pointer;
|
||||||
|
color: #3a8a9e;
|
||||||
|
font-family: Arial;
|
||||||
|
font-size: 17px;
|
||||||
|
padding: 2px 19px;
|
||||||
|
text-decoration: none;
|
||||||
|
text-shadow: 0px 1px 0px #e1e2ed;
|
||||||
|
}
|
||||||
|
|
||||||
|
.myButton:hover {
|
||||||
|
background: linear-gradient(to bottom, #bab1ba 5%, #ededed 100%);
|
||||||
|
background-color: #bab1ba;
|
||||||
|
}
|
||||||
|
|
||||||
|
.myButton:active {
|
||||||
|
position: relative;
|
||||||
|
top: 1px;
|
||||||
|
}
|
||||||
|
|
||||||
|
table {
|
||||||
|
font-family: arial, sans-serif;
|
||||||
|
border-collapse: collapse;
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
td,
|
||||||
|
th {
|
||||||
|
border: 1px solid #dddddd;
|
||||||
|
text-align: left;
|
||||||
|
padding: 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
tr:nth-child(even) {
|
||||||
|
background-color: #EFEFEF;
|
||||||
|
}
|
||||||
|
|
||||||
|
input[type=text],
|
||||||
|
select {
|
||||||
|
width: 100%;
|
||||||
|
padding: 12px 20px;
|
||||||
|
margin: 8px 0;
|
||||||
|
display: inline-block;
|
||||||
|
border: 1px solid #dddddd;
|
||||||
|
border-radius: 4px;
|
||||||
|
box-sizing: border-box;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body onload="retrieveAddressList()">
|
||||||
|
|
||||||
|
<h3>Decentralized GoTo</h3>
|
||||||
|
|
||||||
|
<input type="text" id="domainAddressInput" placeholder="Type domain address here">
|
||||||
|
|
||||||
|
<button class="myButton" onclick="myDomainAddressInputGoTo()">Visit</button>
|
||||||
|
|
||||||
|
<p id="showData"></p>
|
||||||
|
|
||||||
|
<p id="addLocation"></p>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
|
||||||
|
function myDomainAddressInputGoTo() {
|
||||||
|
var hifiUrl = document.getElementById("domainAddressInput").value;
|
||||||
|
if (hifiUrl != "") {
|
||||||
|
var readyEvent = {
|
||||||
|
"action": "goToUrl",
|
||||||
|
"visit": hifiUrl,
|
||||||
|
};
|
||||||
|
EventBridge.emitWebEvent(JSON.stringify(readyEvent));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function choose(choice) {
|
||||||
|
var url = choice;
|
||||||
|
var readyEvent = {
|
||||||
|
"action": "goToUrl",
|
||||||
|
"visit": url,
|
||||||
|
};
|
||||||
|
EventBridge.emitWebEvent(JSON.stringify(readyEvent));
|
||||||
|
}
|
||||||
|
|
||||||
|
function retrieveAddressList() {
|
||||||
|
var readyEvent = {
|
||||||
|
"action": "requestAddressList",
|
||||||
|
};
|
||||||
|
EventBridge.emitWebEvent(JSON.stringify(readyEvent));
|
||||||
|
}
|
||||||
|
|
||||||
|
EventBridge.scriptEventReceived.connect(function (message) {
|
||||||
|
var messageData = JSON.parse(message);
|
||||||
|
if (messageData.action == "addressList") {
|
||||||
|
myAddress = messageData.myAddress;
|
||||||
|
createTableFromJSON();
|
||||||
|
if (messageData.permission) {
|
||||||
|
document.getElementById("addLocation").innerHTML = "<button class=\"myButton\" onclick=\"window.location.href = 'addLocation.html';\">Add Location To GoTo</button>";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
var myAddress = [{}];
|
||||||
|
|
||||||
|
function createTableFromJSON() {
|
||||||
|
|
||||||
|
var col = [];
|
||||||
|
for (var i = 0; i < myAddress.length; i++) {
|
||||||
|
for (var key in myAddress[i]) {
|
||||||
|
if (col.indexOf(key) === -1) {
|
||||||
|
col.push(key);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
var table = document.createElement("table");
|
||||||
|
table.setAttribute('id', 'domains');
|
||||||
|
table.setAttribute('class', 'table table-striped sampleTable domains');
|
||||||
|
|
||||||
|
var thead = table.createTHead();
|
||||||
|
|
||||||
|
//var tr = table.insertRow(-1);
|
||||||
|
|
||||||
|
for (var i = 0; i < col.length; i++) {
|
||||||
|
var th = document.createElement("th");
|
||||||
|
if (col[i] === 'People') th.setAttribute('data-sortas', 'numeric');
|
||||||
|
th.innerHTML = col[i];
|
||||||
|
thead.appendChild(th);
|
||||||
|
}
|
||||||
|
|
||||||
|
var tbdy = document.createElement('tbody');
|
||||||
|
for (var i = 0; i < myAddress.length; i++) {
|
||||||
|
|
||||||
|
tr = table.insertRow(-1);
|
||||||
|
|
||||||
|
for (var j = 0; j < col.length; j++) {
|
||||||
|
var tabCell = tr.insertCell(-1);
|
||||||
|
if (j == 2) {
|
||||||
|
var url = "<input id=\"Button\" class=\"myButton\" type=\"button\" onclick=\"choose('" + myAddress[i][col[j]] + "')\" value=\"Visit\" />";
|
||||||
|
tabCell.innerHTML = url;
|
||||||
|
} else {
|
||||||
|
tabCell.innerHTML = myAddress[i][col[j]];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
var divContainer = document.getElementById("showData");
|
||||||
|
divContainer.innerHTML = "";
|
||||||
|
divContainer.appendChild(table);
|
||||||
|
$("#domains").fancyTable({
|
||||||
|
sortColumn: 3, // column number for initial sorting
|
||||||
|
sortOrder: 'desc', // 'desc', 'descending', 'asc', 'ascending', -1 (descending) and 1 (ascending)
|
||||||
|
sortable: true,
|
||||||
|
pagination: true, // default: false
|
||||||
|
perPage: 7,
|
||||||
|
searchable: true,
|
||||||
|
globalSearch: true,
|
||||||
|
globalSearchExcludeColumns: [3] // exclude column 2 & 5
|
||||||
|
});
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
<script src="jquery.min.js"></script>
|
||||||
|
<script src="bootstrap.min.js"></script>
|
||||||
|
<script src="fancyTable.js"></script>
|
||||||
|
</body>
|
||||||
|
|
||||||
|
</html>
|
|
@ -1,4 +1,13 @@
|
||||||
|
// decentralizedGoTo.js
|
||||||
|
//
|
||||||
|
// Created by Darlingnotin in 2019.
|
||||||
|
// Copyright 2019 Darlingnotin
|
||||||
|
//
|
||||||
|
// Distributed under the ISC license.
|
||||||
|
// See the accompanying file LICENSE or https://opensource.org/licenses/ISC
|
||||||
(function () {
|
(function () {
|
||||||
|
var defaultGoToJSON = "https://metaverse.projectathena.io/interim/d-goto/app/goto.json";
|
||||||
|
|
||||||
var tablet = Tablet.getTablet("com.highfidelity.interface.tablet.system");
|
var tablet = Tablet.getTablet("com.highfidelity.interface.tablet.system");
|
||||||
Menu.menuItemEvent.connect(onMenuItemEvent);
|
Menu.menuItemEvent.connect(onMenuItemEvent);
|
||||||
var AppUi = Script.require('appUi');
|
var AppUi = Script.require('appUi');
|
||||||
|
@ -15,7 +24,7 @@
|
||||||
function startup() {
|
function startup() {
|
||||||
goToAddress = Settings.getValue("goToDecentral", "");
|
goToAddress = Settings.getValue("goToDecentral", "");
|
||||||
if (goToAddress == "") {
|
if (goToAddress == "") {
|
||||||
var initialGoToList = Script.resolvePath("goto.json");
|
var initialGoToList = Script.resolvePath(defaultGoToJSON);
|
||||||
Menu.addMenuItem("GoTo > Unsubscribe from GoTo provider", initialGoToList);
|
Menu.addMenuItem("GoTo > Unsubscribe from GoTo provider", initialGoToList);
|
||||||
goToAddressNow = [
|
goToAddressNow = [
|
||||||
initialGoToList
|
initialGoToList
|
||||||
|
@ -23,7 +32,7 @@
|
||||||
Settings.setValue("goToDecentral", goToAddressNow);
|
Settings.setValue("goToDecentral", goToAddressNow);
|
||||||
}
|
}
|
||||||
ui = new AppUi({
|
ui = new AppUi({
|
||||||
buttonName: "Find",
|
buttonName: "Explore",
|
||||||
home: Script.resolvePath("decentralizedGoTo.html"),
|
home: Script.resolvePath("decentralizedGoTo.html"),
|
||||||
icon: Script.resolvePath("goto-a.svg"),
|
icon: Script.resolvePath("goto-a.svg"),
|
||||||
activeIcon: Script.resolvePath("goto-a-msg.svg")
|
activeIcon: Script.resolvePath("goto-a-msg.svg")
|
217
scripts/communityScripts/decentralizedGoTo/fancyTable.js
Normal file
217
scripts/communityScripts/decentralizedGoTo/fancyTable.js
Normal file
|
@ -0,0 +1,217 @@
|
||||||
|
/*!
|
||||||
|
* jQuery fancyTable plugin
|
||||||
|
* https://github.com/myspace-nu
|
||||||
|
*
|
||||||
|
* Copyright 2018 Johan Johansson
|
||||||
|
* Released under the MIT license
|
||||||
|
*/
|
||||||
|
(function($) {
|
||||||
|
$.fn.fancyTable = function(options) {
|
||||||
|
var settings = $.extend({
|
||||||
|
inputStyle: "",
|
||||||
|
inputPlaceholder: "Search...",
|
||||||
|
pagination: false,
|
||||||
|
paginationClass: "btn btn-light",
|
||||||
|
paginationClassActive: "active",
|
||||||
|
pagClosest: 3,
|
||||||
|
perPage: 10,
|
||||||
|
sortable: true,
|
||||||
|
searchable: true,
|
||||||
|
onInit: function(){ },
|
||||||
|
onUpdate: function(){ },
|
||||||
|
testing: false
|
||||||
|
}, options);
|
||||||
|
var instance = this;
|
||||||
|
this.settings = settings;
|
||||||
|
this.tableUpdate = function (elm) {
|
||||||
|
elm.fancyTable.matches = 0;
|
||||||
|
$(elm).find("tbody tr").each(function() {
|
||||||
|
var n=0;
|
||||||
|
var match = true;
|
||||||
|
var globalMatch = false;
|
||||||
|
$(this).find("td").each(function() {
|
||||||
|
if(!settings.globalSearch && elm.fancyTable.searchArr[n] && !(new RegExp(elm.fancyTable.searchArr[n],"i").test($(this).html()))){
|
||||||
|
match = false;
|
||||||
|
} else if(settings.globalSearch && (!elm.fancyTable.search || (new RegExp(elm.fancyTable.search,"i").test($(this).html())))){
|
||||||
|
if(!Array.isArray(settings.globalSearchExcludeColumns) || !settings.globalSearchExcludeColumns.includes(n+1)){
|
||||||
|
globalMatch = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
n++;
|
||||||
|
});
|
||||||
|
if((settings.globalSearch && globalMatch) || (!settings.globalSearch && match)){
|
||||||
|
elm.fancyTable.matches++
|
||||||
|
if(!settings.pagination || (elm.fancyTable.matches>(elm.fancyTable.perPage*(elm.fancyTable.page-1)) && elm.fancyTable.matches<=(elm.fancyTable.perPage*elm.fancyTable.page))){
|
||||||
|
$(this).show();
|
||||||
|
} else {
|
||||||
|
$(this).hide();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$(this).hide();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
elm.fancyTable.pages = Math.ceil(elm.fancyTable.matches/elm.fancyTable.perPage);
|
||||||
|
if(settings.pagination){
|
||||||
|
var paginationElement = (elm.fancyTable.paginationElement) ? $(elm.fancyTable.paginationElement) : $(elm).find(".pag");
|
||||||
|
paginationElement.empty();
|
||||||
|
for(var n=1; n<=elm.fancyTable.pages; n++){
|
||||||
|
if(n==1 || (n>(elm.fancyTable.page-(settings.pagClosest+1)) && n<(elm.fancyTable.page+(settings.pagClosest+1))) || n==elm.fancyTable.pages){
|
||||||
|
var a = $("<a>",{
|
||||||
|
html:n,
|
||||||
|
"data-n": n,
|
||||||
|
style:"margin:0.2em",
|
||||||
|
class:settings.paginationClass+" "+((n==elm.fancyTable.page)?settings.paginationClassActive:"")
|
||||||
|
}).css("cursor","pointer").bind("click",function(){
|
||||||
|
elm.fancyTable.page = $(this).data("n");
|
||||||
|
instance.tableUpdate(elm);
|
||||||
|
});
|
||||||
|
if(n==elm.fancyTable.pages && elm.fancyTable.page<(elm.fancyTable.pages-settings.pagClosest-1)){
|
||||||
|
paginationElement.append($("<span>...</span>"));
|
||||||
|
}
|
||||||
|
paginationElement.append(a);
|
||||||
|
if(n==1 && elm.fancyTable.page>settings.pagClosest+2){
|
||||||
|
paginationElement.append($("<span>...</span>"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
settings.onUpdate.call(this,elm);
|
||||||
|
};
|
||||||
|
this.reinit = function(elm){
|
||||||
|
$(this).each(function(){
|
||||||
|
$(this).find("th a").contents().unwrap();
|
||||||
|
$(this).find("tr.fancySearchRow").remove();
|
||||||
|
});
|
||||||
|
$(this).fancyTable(this.settings);
|
||||||
|
};
|
||||||
|
this.tableSort = function (elm) {
|
||||||
|
if(typeof elm.fancyTable.sortColumn !== "undefined" && elm.fancyTable.sortColumn < elm.fancyTable.nColumns){
|
||||||
|
$(elm).find("thead th div.sortArrow").each(function(){
|
||||||
|
$(this).remove();
|
||||||
|
});
|
||||||
|
var sortArrow = $("<div>",{"class":"sortArrow"}).css({"margin":"0.1em","display":"inline-block","width":0,"height":0,"border-left":"0.4em solid transparent","border-right":"0.4em solid transparent"});
|
||||||
|
sortArrow.css(
|
||||||
|
(elm.fancyTable.sortOrder>0) ?
|
||||||
|
{"border-top":"0.4em solid #000"} :
|
||||||
|
{"border-bottom":"0.4em solid #000"}
|
||||||
|
);
|
||||||
|
$(elm).find("thead th a").eq(elm.fancyTable.sortColumn).append(sortArrow);
|
||||||
|
var rows = $(elm).find("tbody tr").toArray().sort(
|
||||||
|
function(a, b) {
|
||||||
|
var stra = $(a).find("td").eq(elm.fancyTable.sortColumn).html();
|
||||||
|
var strb = $(b).find("td").eq(elm.fancyTable.sortColumn).html();
|
||||||
|
if(elm.fancyTable.sortAs[elm.fancyTable.sortColumn] == 'numeric'){
|
||||||
|
return((elm.fancyTable.sortOrder>0) ? parseFloat(stra)-parseFloat(strb) : parseFloat(strb)-parseFloat(stra));
|
||||||
|
} else {
|
||||||
|
return((stra<strb)?-elm.fancyTable.sortOrder:(stra>strb)?elm.fancyTable.sortOrder:0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
$(elm).find("tbody").empty().append(rows);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
this.each(function() {
|
||||||
|
if($(this).prop("tagName")!=="TABLE"){
|
||||||
|
console.warn("fancyTable: Element is not a table.");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
var elm = this;
|
||||||
|
elm.fancyTable = {
|
||||||
|
nColumns: $(elm).find("td").first().parent().find("td").length,
|
||||||
|
nRows : $(this).find("tbody tr").length,
|
||||||
|
perPage : settings.perPage,
|
||||||
|
page : 1,
|
||||||
|
pages : 0,
|
||||||
|
matches : 0,
|
||||||
|
searchArr : [],
|
||||||
|
search : "",
|
||||||
|
sortColumn : settings.sortColumn,
|
||||||
|
sortOrder : (typeof settings.sortOrder === "undefined") ? 1 : (new RegExp("desc","i").test(settings.sortOrder) || settings.sortOrder == -1) ? -1 : 1,
|
||||||
|
sortAs:[], // undefined or numeric
|
||||||
|
paginationElement : settings.paginationElement
|
||||||
|
};
|
||||||
|
if($(elm).find("tbody").length==0){
|
||||||
|
var content = $(elm).html();
|
||||||
|
$(elm).empty();
|
||||||
|
$(elm).append("<tbody>").append($(content));
|
||||||
|
}
|
||||||
|
if($(elm).find("thead").length==0){
|
||||||
|
$(elm).prepend($("<thead>"));
|
||||||
|
// Maybe add generated headers at some point
|
||||||
|
//var c=$(elm).find("tr").first().find("td").length;
|
||||||
|
//for(var n=0; n<c; n++){
|
||||||
|
// $(elm).find("thead").append($("<th></th>"));
|
||||||
|
//}
|
||||||
|
}
|
||||||
|
if(settings.sortable){
|
||||||
|
var n=0;
|
||||||
|
$(elm).find("thead th").each(function() {
|
||||||
|
elm.fancyTable.sortAs.push(($(this).data('sortas')=='numeric')?'numeric':'');
|
||||||
|
var content = $(this).html();
|
||||||
|
var a = $("<a>",{
|
||||||
|
html:content,
|
||||||
|
"data-n": n,
|
||||||
|
class:""
|
||||||
|
}).css("cursor","pointer").bind("click",function(){
|
||||||
|
if(elm.fancyTable.sortColumn == $(this).data("n")){
|
||||||
|
elm.fancyTable.sortOrder=-elm.fancyTable.sortOrder;
|
||||||
|
} else {
|
||||||
|
elm.fancyTable.sortOrder=1;
|
||||||
|
}
|
||||||
|
elm.fancyTable.sortColumn = $(this).data("n");
|
||||||
|
instance.tableSort(elm);
|
||||||
|
instance.tableUpdate(elm);
|
||||||
|
});
|
||||||
|
$(this).empty();
|
||||||
|
$(this).append(a);
|
||||||
|
n++;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
if(settings.searchable){
|
||||||
|
var searchHeader = $("<tr>").addClass("fancySearchRow");
|
||||||
|
if(settings.globalSearch){
|
||||||
|
var searchField = $("<input>",{
|
||||||
|
"placeholder": settings.inputPlaceholder,
|
||||||
|
style:"width:100%;"+settings.inputStyle
|
||||||
|
}).bind("change paste keyup",function(){
|
||||||
|
elm.fancyTable.search = $(this).val();
|
||||||
|
elm.fancyTable.page = 1;
|
||||||
|
instance.tableUpdate(elm);
|
||||||
|
});
|
||||||
|
var th = $("<th>",{ style:"padding:2px;" }).attr("colspan",elm.fancyTable.nColumns);
|
||||||
|
$(searchField).appendTo($(th));
|
||||||
|
$(th).appendTo($(searchHeader));
|
||||||
|
} else {
|
||||||
|
var n=0;
|
||||||
|
$(elm).find("td").first().parent().find("td").each(function() {
|
||||||
|
elm.fancyTable.searchArr.push("");
|
||||||
|
var searchField = $("<input>",{
|
||||||
|
"data-n": n,
|
||||||
|
"placeholder": settings.inputPlaceholder,
|
||||||
|
style:"width:100%;"+settings.inputStyle
|
||||||
|
}).bind("change paste keyup",function(){
|
||||||
|
elm.fancyTable.searchArr[$(this).data("n")] = $(this).val();
|
||||||
|
elm.fancyTable.page = 1;
|
||||||
|
instance.tableUpdate(elm);
|
||||||
|
});
|
||||||
|
var th = $("<th>",{ style:"padding:2px;" });
|
||||||
|
$(searchField).appendTo($(th));
|
||||||
|
$(th).appendTo($(searchHeader));
|
||||||
|
n++;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
searchHeader.appendTo($(elm).find("thead"));
|
||||||
|
}
|
||||||
|
// Sort
|
||||||
|
instance.tableSort(elm);
|
||||||
|
if(settings.pagination && !settings.paginationElement){
|
||||||
|
$(elm).find("tfoot").remove();
|
||||||
|
$(elm).append($("<tfoot><tr></tr></tfoot>"));
|
||||||
|
$(elm).find("tfoot tr").append($("<td class='pag'></td>",{ }).attr("colspan",elm.fancyTable.nColumns));
|
||||||
|
}
|
||||||
|
instance.tableUpdate(elm);
|
||||||
|
settings.onInit.call(this,elm);
|
||||||
|
});
|
||||||
|
return this;
|
||||||
|
};
|
||||||
|
}(jQuery));
|
57
scripts/communityScripts/decentralizedGoTo/goto-a-msg.svg
Normal file
57
scripts/communityScripts/decentralizedGoTo/goto-a-msg.svg
Normal file
|
@ -0,0 +1,57 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||||
|
<!-- Generator: Adobe Illustrator 19.2.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
|
||||||
|
|
||||||
|
<svg
|
||||||
|
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||||
|
xmlns:cc="http://creativecommons.org/ns#"
|
||||||
|
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||||
|
xmlns:svg="http://www.w3.org/2000/svg"
|
||||||
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
|
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||||
|
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||||
|
version="1.1"
|
||||||
|
x="0px"
|
||||||
|
y="0px"
|
||||||
|
viewBox="0 0 50 50"
|
||||||
|
style="enable-background:new 0 0 50 50;"
|
||||||
|
xml:space="preserve"
|
||||||
|
id="svg2"
|
||||||
|
inkscape:version="0.91 r13725"
|
||||||
|
sodipodi:docname="goto-a.svg"><metadata
|
||||||
|
id="metadata14"><rdf:RDF><cc:Work
|
||||||
|
rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type
|
||||||
|
rdf:resource="http://purl.org/dc/dcmitype/StillImage" /><dc:title></dc:title></cc:Work></rdf:RDF></metadata><defs
|
||||||
|
id="defs12" /><sodipodi:namedview
|
||||||
|
pagecolor="#ff0000"
|
||||||
|
bordercolor="#666666"
|
||||||
|
borderopacity="1"
|
||||||
|
objecttolerance="10"
|
||||||
|
gridtolerance="10"
|
||||||
|
guidetolerance="10"
|
||||||
|
inkscape:pageopacity="0"
|
||||||
|
inkscape:pageshadow="2"
|
||||||
|
inkscape:window-width="852"
|
||||||
|
inkscape:window-height="480"
|
||||||
|
id="namedview10"
|
||||||
|
showgrid="false"
|
||||||
|
inkscape:zoom="4.72"
|
||||||
|
inkscape:cx="25"
|
||||||
|
inkscape:cy="25"
|
||||||
|
inkscape:window-x="0"
|
||||||
|
inkscape:window-y="0"
|
||||||
|
inkscape:window-maximized="0"
|
||||||
|
inkscape:current-layer="svg2" /><style
|
||||||
|
type="text/css"
|
||||||
|
id="style4">
|
||||||
|
.st0{fill:#FFFFFF;}
|
||||||
|
.st1{fill:#EF3B4E;}
|
||||||
|
</style>
|
||||||
|
<circle class="st1" cx="44.1" cy="6" r="5.6"/>
|
||||||
|
<g
|
||||||
|
id="Layer_2" /><g
|
||||||
|
id="Layer_1"
|
||||||
|
style="fill:#000000;fill-opacity:1"><path
|
||||||
|
class="st0"
|
||||||
|
d="M47.2,41.3l-9.1-9.1c-0.8-0.8-1.9-1.1-3-1l-2.4-2.4c1.8-2.6,2.8-5.7,2.8-9c0-8.9-7.2-16.1-16.1-16.1 S3.3,11,3.3,19.8c0,8.9,7.2,16.1,16.1,16.1c4.1,0,7.8-1.5,10.6-4l2.2,2.2c-0.2,1.1,0.1,2.2,1,3l9.1,9.1c1.4,1.4,3.6,1.4,4.9,0 C48.5,44.9,48.5,42.7,47.2,41.3z M19.4,32.2c-6.8,0-12.3-5.5-12.3-12.3c0-6.8,5.5-12.3,12.3-12.3s12.3,5.5,12.3,12.3 C31.8,26.6,26.2,32.2,19.4,32.2z"
|
||||||
|
id="path8"
|
||||||
|
style="fill:#000000;fill-opacity:1" /></g></svg>
|
After Width: | Height: | Size: 2.2 KiB |
54
scripts/communityScripts/decentralizedGoTo/goto-a.svg
Normal file
54
scripts/communityScripts/decentralizedGoTo/goto-a.svg
Normal file
|
@ -0,0 +1,54 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||||
|
<!-- Generator: Adobe Illustrator 19.2.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
|
||||||
|
|
||||||
|
<svg
|
||||||
|
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||||
|
xmlns:cc="http://creativecommons.org/ns#"
|
||||||
|
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||||
|
xmlns:svg="http://www.w3.org/2000/svg"
|
||||||
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
|
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||||
|
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||||
|
version="1.1"
|
||||||
|
x="0px"
|
||||||
|
y="0px"
|
||||||
|
viewBox="0 0 50 50"
|
||||||
|
style="enable-background:new 0 0 50 50;"
|
||||||
|
xml:space="preserve"
|
||||||
|
id="svg2"
|
||||||
|
inkscape:version="0.91 r13725"
|
||||||
|
sodipodi:docname="goto-a.svg"><metadata
|
||||||
|
id="metadata14"><rdf:RDF><cc:Work
|
||||||
|
rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type
|
||||||
|
rdf:resource="http://purl.org/dc/dcmitype/StillImage" /><dc:title></dc:title></cc:Work></rdf:RDF></metadata><defs
|
||||||
|
id="defs12" /><sodipodi:namedview
|
||||||
|
pagecolor="#ff0000"
|
||||||
|
bordercolor="#666666"
|
||||||
|
borderopacity="1"
|
||||||
|
objecttolerance="10"
|
||||||
|
gridtolerance="10"
|
||||||
|
guidetolerance="10"
|
||||||
|
inkscape:pageopacity="0"
|
||||||
|
inkscape:pageshadow="2"
|
||||||
|
inkscape:window-width="852"
|
||||||
|
inkscape:window-height="480"
|
||||||
|
id="namedview10"
|
||||||
|
showgrid="false"
|
||||||
|
inkscape:zoom="4.72"
|
||||||
|
inkscape:cx="25"
|
||||||
|
inkscape:cy="25"
|
||||||
|
inkscape:window-x="0"
|
||||||
|
inkscape:window-y="0"
|
||||||
|
inkscape:window-maximized="0"
|
||||||
|
inkscape:current-layer="svg2" /><style
|
||||||
|
type="text/css"
|
||||||
|
id="style4">
|
||||||
|
.st0{fill:#FFFFFF;}
|
||||||
|
</style><g
|
||||||
|
id="Layer_2" /><g
|
||||||
|
id="Layer_1"
|
||||||
|
style="fill:#000000;fill-opacity:1"><path
|
||||||
|
class="st0"
|
||||||
|
d="M47.2,41.3l-9.1-9.1c-0.8-0.8-1.9-1.1-3-1l-2.4-2.4c1.8-2.6,2.8-5.7,2.8-9c0-8.9-7.2-16.1-16.1-16.1 S3.3,11,3.3,19.8c0,8.9,7.2,16.1,16.1,16.1c4.1,0,7.8-1.5,10.6-4l2.2,2.2c-0.2,1.1,0.1,2.2,1,3l9.1,9.1c1.4,1.4,3.6,1.4,4.9,0 C48.5,44.9,48.5,42.7,47.2,41.3z M19.4,32.2c-6.8,0-12.3-5.5-12.3-12.3c0-6.8,5.5-12.3,12.3-12.3s12.3,5.5,12.3,12.3 C31.8,26.6,26.2,32.2,19.4,32.2z"
|
||||||
|
id="path8"
|
||||||
|
style="fill:#000000;fill-opacity:1" /></g></svg>
|
After Width: | Height: | Size: 2.2 KiB |
2
scripts/communityScripts/decentralizedGoTo/jquery.min.js
vendored
Normal file
2
scripts/communityScripts/decentralizedGoTo/jquery.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
Loading…
Reference in a new issue