mirror of
https://github.com/tdurieux/anonymous_github.git
synced 2026-05-15 22:48:00 +02:00
improve page design
This commit is contained in:
+68
-59
@@ -10,75 +10,19 @@ angular
|
||||
.when("/:path*", {
|
||||
templateUrl: "/partials/explore.htm",
|
||||
controller: "exploreController",
|
||||
title: "Explore",
|
||||
title: "Anonymized Repository - Anonymous GitHub",
|
||||
})
|
||||
.otherwise({
|
||||
templateUrl: "/partials/loading.htm",
|
||||
title: "Anonymous Github",
|
||||
title: "Loading - Anonymous GitHub",
|
||||
});
|
||||
$locationProvider.html5Mode(true);
|
||||
})
|
||||
.factory("RecursionHelper", [
|
||||
"$compile",
|
||||
function($compile) {
|
||||
return {
|
||||
/**
|
||||
* Manually compiles the element, fixing the recursion loop.
|
||||
* @param element
|
||||
* @param [link] A post-link function, or an object with function(s) registered via pre and post properties.
|
||||
* @returns An object containing the linking functions.
|
||||
*/
|
||||
compile: function(element, link) {
|
||||
// Normalize the link parameter
|
||||
if (angular.isFunction(link)) {
|
||||
link = { post: link };
|
||||
}
|
||||
|
||||
// Break the recursion loop by removing the contents
|
||||
var contents = element.contents().remove();
|
||||
var compiledContents;
|
||||
return {
|
||||
pre: link && link.pre ? link.pre : null,
|
||||
/**
|
||||
* Compiles and re-adds the contents
|
||||
*/
|
||||
post: function(scope, element) {
|
||||
// Compile the contents
|
||||
if (!compiledContents) {
|
||||
compiledContents = $compile(contents);
|
||||
}
|
||||
// Re-add the compiled contents to the element
|
||||
compiledContents(scope, function(clone) {
|
||||
element.append(clone);
|
||||
});
|
||||
|
||||
// Call the post-linking function, if any
|
||||
if (link && link.post) {
|
||||
link.post.apply(null, arguments);
|
||||
}
|
||||
},
|
||||
};
|
||||
},
|
||||
};
|
||||
},
|
||||
])
|
||||
.directive("tree", [
|
||||
"RecursionHelper",
|
||||
function(RecursionHelper) {
|
||||
function() {
|
||||
return {
|
||||
restrict: "E",
|
||||
scope: { file: "=", parent: "@" },
|
||||
// template:
|
||||
// "<ul>" +
|
||||
// '<li class="file" ng-repeat="f in afiles" ng-class="{folder: isDir(f.child), active: isActive(f.name), open: opens[f.name]}">' +
|
||||
// "<a href='/r/{{repoId}}/{{parent}}/{{f.name}}' ng-if='!isDir(f.child)'>{{f.name}}</a>" +
|
||||
// "<a ng-click='openFolder(f.name)' ng-if='isDir(f.child)'>{{f.name}}</a>" +
|
||||
// '<tree file="f.child" parent="{{parent}}/{{f.name}}" ng-if="isDir(f.child)""></tree>' +
|
||||
// "</li>" +
|
||||
// "</ul>",
|
||||
compile: function(element) {
|
||||
return RecursionHelper.compile(element);
|
||||
},
|
||||
controller: function($element, $scope, $location, $compile) {
|
||||
$scope.repoId = document.location.pathname.split("/")[2];
|
||||
|
||||
@@ -216,6 +160,55 @@ angular
|
||||
};
|
||||
},
|
||||
])
|
||||
.directive("loc", [
|
||||
function() {
|
||||
return {
|
||||
restrict: "E",
|
||||
scope: { stats: "=" },
|
||||
template:
|
||||
"<div class='lang' ng-repeat='lang in elements' title='{{lang.lang|title}}: {{lang.loc | number}} lines' data-toggle='tooltip' data-placement='bottom' style='width:{{lang.loc*100/total}}%;background:{{lang.color}};'></div>",
|
||||
controller: function($scope) {
|
||||
function render() {
|
||||
$scope.elements = [];
|
||||
$scope.total = 0;
|
||||
for (let lang in $scope.stats) {
|
||||
const loc = $scope.stats[lang].code;
|
||||
if (!loc) {
|
||||
continue;
|
||||
}
|
||||
$scope.total += loc;
|
||||
$scope.elements.push({
|
||||
lang,
|
||||
loc,
|
||||
color: langColors[lang],
|
||||
});
|
||||
}
|
||||
setTimeout(() => {
|
||||
$('[data-toggle="tooltip"]').tooltip();
|
||||
}, 100);
|
||||
}
|
||||
|
||||
$scope.$watch("stats", (v) => {
|
||||
render();
|
||||
});
|
||||
render();
|
||||
},
|
||||
};
|
||||
},
|
||||
])
|
||||
.filter("title", function() {
|
||||
return function(str) {
|
||||
if (!str) return str;
|
||||
|
||||
str = str.toLowerCase();
|
||||
var words = str.split(" ");
|
||||
|
||||
var capitalized = words.map(function(word) {
|
||||
return word.charAt(0).toUpperCase() + word.substring(1, word.length);
|
||||
});
|
||||
return capitalized.join(" ");
|
||||
};
|
||||
})
|
||||
.filter("filterObj", function() {
|
||||
return function(input, search) {
|
||||
if (!input) return input;
|
||||
@@ -239,6 +232,9 @@ angular
|
||||
.split("/");
|
||||
|
||||
$scope.$on("$routeChangeSuccess", function(event, current) {
|
||||
if (current) {
|
||||
$scope.title = current.title;
|
||||
}
|
||||
$scope.paths = $location
|
||||
.path()
|
||||
.substring(1)
|
||||
@@ -288,6 +284,19 @@ angular
|
||||
);
|
||||
}
|
||||
getUser();
|
||||
|
||||
function getMessage() {
|
||||
$http.get("/api/message").then(
|
||||
(res) => {
|
||||
if (res) $scope.generalMessage = res.data;
|
||||
},
|
||||
() => {
|
||||
$scope.generalMessage = null;
|
||||
}
|
||||
);
|
||||
}
|
||||
getMessage();
|
||||
|
||||
async function getOptions(callback) {
|
||||
$http.get(`/api/repo/${$scope.repoId}/options`).then(
|
||||
(res) => {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
angular
|
||||
.module("anonymous-github", ["ngRoute"])
|
||||
.module("anonymous-github", ["ngRoute", "ngSanitize"])
|
||||
.config(function($routeProvider, $locationProvider) {
|
||||
$routeProvider
|
||||
.when("/", {
|
||||
@@ -10,30 +10,30 @@ angular
|
||||
.when("/dashboard", {
|
||||
templateUrl: "/partials/dashboard.htm",
|
||||
controller: "dashboardController",
|
||||
title: "Anonymous GitHub",
|
||||
title: "Dashboard - Anonymous GitHub",
|
||||
})
|
||||
.when("/anonymize/:repoId?", {
|
||||
templateUrl: "/partials/anonymize.htm",
|
||||
controller: "anonymizeController",
|
||||
title: "Anonymous GitHub",
|
||||
title: "Anonymize - Anonymous GitHub",
|
||||
})
|
||||
.when("/404", {
|
||||
templateUrl: "/partials/404.htm",
|
||||
title: "Not Found!",
|
||||
title: "Page not found - Anonymous GitHub",
|
||||
})
|
||||
.when("/faq", {
|
||||
templateUrl: "/partials/faq.htm",
|
||||
controller: "faqController",
|
||||
title: "Not Found!",
|
||||
title: "FAQ - Anonymous GitHub",
|
||||
})
|
||||
.when("/claim", {
|
||||
templateUrl: "/partials/claim.htm",
|
||||
controller: "claimController",
|
||||
title: "Not Found!",
|
||||
title: "Claim repository - Anonymous GitHub",
|
||||
})
|
||||
.otherwise({
|
||||
templateUrl: "/partials/404.htm",
|
||||
title: "Not Found!",
|
||||
title: "Page not found - Anonymous GitHub",
|
||||
});
|
||||
$locationProvider.html5Mode(true);
|
||||
})
|
||||
@@ -66,6 +66,18 @@ angular
|
||||
}
|
||||
getUser();
|
||||
|
||||
function getMessage() {
|
||||
$http.get("/api/message").then(
|
||||
(res) => {
|
||||
if (res) $scope.generalMessage = res.data;
|
||||
},
|
||||
() => {
|
||||
$scope.generalMessage = null;
|
||||
}
|
||||
);
|
||||
}
|
||||
getMessage();
|
||||
|
||||
$scope.$on("$routeChangeSuccess", function(event, current) {
|
||||
if (current) {
|
||||
$scope.title = current.title;
|
||||
@@ -87,7 +99,6 @@ angular
|
||||
$scope.repoId = null;
|
||||
$scope.repoUrl = null;
|
||||
$scope.claim = () => {
|
||||
console.log("here");
|
||||
$http
|
||||
.post("/api/repo/claim", {
|
||||
repoId: $scope.repoId,
|
||||
@@ -339,7 +350,6 @@ angular
|
||||
}
|
||||
async function getDetails() {
|
||||
const o = parseGithubUrl($scope.repoUrl);
|
||||
console.log(o, $scope.repoUrl)
|
||||
try {
|
||||
$scope.anonymize.repoUrl.$setValidity("missing", true);
|
||||
const res = await $http.get(`/api/repo/${o.owner}/${o.repo}/`);
|
||||
|
||||
@@ -0,0 +1,316 @@
|
||||
window.langColors = {
|
||||
"1c enterprise": "#814ccc",
|
||||
"abap": "#e8274b",
|
||||
"abap cds": "#555e25",
|
||||
"actionscript": "#882b0f",
|
||||
"ada": "#02f88c",
|
||||
"agda": "#315665",
|
||||
"ags script": "#b9d9ff",
|
||||
"al": "#3aa2b5",
|
||||
"alloy": "#64c800",
|
||||
"ampl": "#e6efbb",
|
||||
"angelscript": "#c7d7dc",
|
||||
"antlr": "#9dc3ff",
|
||||
"apex": "#1797c0",
|
||||
"api blueprint": "#2acca8",
|
||||
"apl": "#5a8164",
|
||||
"apollo guidance computer": "#0b3d91",
|
||||
"applescript": "#101f1f",
|
||||
"arc": "#aa2afe",
|
||||
"asp.net": "#9400ff",
|
||||
"aspectj": "#a957b0",
|
||||
"assembly": "#6e4c13",
|
||||
"asymptote": "#ff0000",
|
||||
"ats": "#1ac620",
|
||||
"autohotkey": "#6594b9",
|
||||
"autoit": "#1c3552",
|
||||
"ballerina": "#ff5000",
|
||||
"batchfile": "#c1f12e",
|
||||
"beef": "#a52f4e",
|
||||
"bison": "#6a463f",
|
||||
"blade": "#f7523f",
|
||||
"blitzmax": "#cd6400",
|
||||
"boo": "#d4bec1",
|
||||
"boogie": "#c80fa0",
|
||||
"brainfuck": "#2f2530",
|
||||
"browserslist": "#ffd539",
|
||||
"c": "#555555",
|
||||
"c#": "#178600",
|
||||
"c++": "#f34b7d",
|
||||
"ceylon": "#dfa535",
|
||||
"chapel": "#8dc63f",
|
||||
"cirru": "#ccccff",
|
||||
"clarion": "#db901e",
|
||||
"classic asp": "#6a40fd",
|
||||
"clean": "#3f85af",
|
||||
"click": "#e4e6f3",
|
||||
"clojure": "#db5855",
|
||||
"closure templates": "#0d948f",
|
||||
"coffeescript": "#244776",
|
||||
"coldfusion": "#ed2cd6",
|
||||
"coldfusion cfc": "#ed2cd6",
|
||||
"common lisp": "#3fb68b",
|
||||
"common workflow language": "#b5314c",
|
||||
"component pascal": "#b0ce4e",
|
||||
"crystal": "#000100",
|
||||
"cson": "#244776",
|
||||
"css": "#563d7c",
|
||||
"cuda": "#3a4e3a",
|
||||
"d": "#ba595e",
|
||||
"dafny": "#ffec25",
|
||||
"dart": "#00b4ab",
|
||||
"dataweave": "#003a52",
|
||||
"dhall": "#dfafff",
|
||||
"dm": "#447265",
|
||||
"dockerfile": "#384d54",
|
||||
"dogescript": "#cca760",
|
||||
"dylan": "#6c616e",
|
||||
"e": "#ccce35",
|
||||
"ec": "#913960",
|
||||
"ecl": "#8a1267",
|
||||
"eiffel": "#4d6977",
|
||||
"ejs": "#a91e50",
|
||||
"elixir": "#6e4a7e",
|
||||
"elm": "#60b5cc",
|
||||
"emacs lisp": "#c065db",
|
||||
"emberscript": "#fff4f3",
|
||||
"eq": "#a78649",
|
||||
"erlang": "#b83998",
|
||||
"f#": "#b845fc",
|
||||
"f*": "#572e30",
|
||||
"factor": "#636746",
|
||||
"fancy": "#7b9db4",
|
||||
"fantom": "#14253c",
|
||||
"faust": "#c37240",
|
||||
"flux": "#88ccff",
|
||||
"forth": "#341708",
|
||||
"fortran": "#4d41b1",
|
||||
"freemarker": "#0050b2",
|
||||
"frege": "#00cafe",
|
||||
"futhark": "#5f021f",
|
||||
"g-code": "#d08cf2",
|
||||
"game maker language": "#71b417",
|
||||
"gaml": "#ffc766",
|
||||
"gdscript": "#355570",
|
||||
"gemfile.lock": "#701516",
|
||||
"genie": "#fb855d",
|
||||
"gherkin": "#5b2063",
|
||||
"glyph": "#c1ac7f",
|
||||
"gnuplot": "#f0a9f0",
|
||||
"go": "#00add8",
|
||||
"golo": "#88562a",
|
||||
"gosu": "#82937f",
|
||||
"grammatical framework": "#ff0000",
|
||||
"graphql": "#e10098",
|
||||
"groovy": "#e69f56",
|
||||
"hack": "#878787",
|
||||
"haml": "#ece2a9",
|
||||
"handlebars": "#f7931e",
|
||||
"harbour": "#0e60e3",
|
||||
"haskell": "#5e5086",
|
||||
"haxe": "#df7900",
|
||||
"hiveql": "#dce200",
|
||||
"holyc": "#ffefaf",
|
||||
"html": "#e34c26",
|
||||
"hy": "#7790b2",
|
||||
"idl": "#a3522f",
|
||||
"idris": "#b30000",
|
||||
"igor pro": "#0000cc",
|
||||
"imagej macro": "#99aaff",
|
||||
"io": "#a9188d",
|
||||
"ioke": "#078193",
|
||||
"isabelle": "#fefe00",
|
||||
"j": "#9eedff",
|
||||
"java": "#b07219",
|
||||
"javascript": "#f1e05a",
|
||||
"jflex": "#dbca00",
|
||||
"jolie": "#843179",
|
||||
"jq": "#c7254e",
|
||||
"jsoniq": "#40d47e",
|
||||
"jsonnet": "#0064bd",
|
||||
"julia": "#a270ba",
|
||||
"jupyter notebook": "#da5b0b",
|
||||
"kaitai struct": "#773b37",
|
||||
"kotlin": "#f18e33",
|
||||
"krl": "#28430a",
|
||||
"lark": "#2980b9",
|
||||
"lasso": "#999999",
|
||||
"latte": "#f2a542",
|
||||
"less": "#1d365d",
|
||||
"lex": "#dbca00",
|
||||
"lfe": "#4c3023",
|
||||
"liquid": "#67b8de",
|
||||
"livescript": "#499886",
|
||||
"llvm": "#185619",
|
||||
"lolcode": "#cc9900",
|
||||
"lookml": "#652b81",
|
||||
"lsl": "#3d9970",
|
||||
"lua": "#000080",
|
||||
"macaulay2": "#d8ffff",
|
||||
"makefile": "#427819",
|
||||
"markdown": "#083fa1",
|
||||
"marko": "#42bff2",
|
||||
"mask": "#f97732",
|
||||
"matlab": "#e16737",
|
||||
"max": "#c4a79c",
|
||||
"maxscript": "#00a6a6",
|
||||
"mcfunction": "#e22837",
|
||||
"mercury": "#ff2b2b",
|
||||
"meson": "#007800",
|
||||
"metal": "#8f14e9",
|
||||
"mirah": "#c7a938",
|
||||
"mirc script": "#3d57c3",
|
||||
"mlir": "#5ec8db",
|
||||
"modula-3": "#223388",
|
||||
"mql4": "#62a8d6",
|
||||
"mql5": "#4a76b8",
|
||||
"mtml": "#b7e1f4",
|
||||
"mustache": "#724b3b",
|
||||
"ncl": "#28431f",
|
||||
"nearley": "#990000",
|
||||
"nemerle": "#3d3c6e",
|
||||
"nesc": "#94b0c7",
|
||||
"netlinx": "#0aa0ff",
|
||||
"netlinx+erb": "#747faa",
|
||||
"netlogo": "#ff6375",
|
||||
"newlisp": "#87aed7",
|
||||
"nextflow": "#3ac486",
|
||||
"nim": "#ffc200",
|
||||
"nit": "#009917",
|
||||
"nix": "#7e7eff",
|
||||
"nu": "#c9df40",
|
||||
"numpy": "#9c8af9",
|
||||
"nunjucks": "#3d8137",
|
||||
"nwscript": "#111522",
|
||||
"objective-c": "#438eff",
|
||||
"objective-c++": "#6866fb",
|
||||
"objective-j": "#ff0c5a",
|
||||
"objectscript": "#424893",
|
||||
"ocaml": "#3be133",
|
||||
"odin": "#60affe",
|
||||
"omgrofl": "#cabbff",
|
||||
"ooc": "#b0b77e",
|
||||
"opal": "#f7ede0",
|
||||
"openqasm": "#aa70ff",
|
||||
"org": "#77aa99",
|
||||
"oxygene": "#cdd0e3",
|
||||
"oz": "#fab738",
|
||||
"p4": "#7055b5",
|
||||
"pan": "#cc0000",
|
||||
"papyrus": "#6600cc",
|
||||
"parrot": "#f3ca0a",
|
||||
"pascal": "#e3f171",
|
||||
"pawn": "#dbb284",
|
||||
"pep8": "#c76f5b",
|
||||
"perl": "#0298c3",
|
||||
"php": "#4f5d95",
|
||||
"piglatin": "#fcd7de",
|
||||
"pike": "#005390",
|
||||
"plsql": "#dad8d8",
|
||||
"pogoscript": "#d80074",
|
||||
"postscript": "#da291c",
|
||||
"powerbuilder": "#8f0f8d",
|
||||
"powershell": "#012456",
|
||||
"prisma": "#0c344b",
|
||||
"processing": "#0096d8",
|
||||
"prolog": "#74283c",
|
||||
"propeller spin": "#7fa2a7",
|
||||
"pug": "#a86454",
|
||||
"puppet": "#302b6d",
|
||||
"purebasic": "#5a6986",
|
||||
"purescript": "#1d222d",
|
||||
"python": "#3572a5",
|
||||
"q": "#0040cd",
|
||||
"q#": "#fed659",
|
||||
"qml": "#44a51c",
|
||||
"qt script": "#00b841",
|
||||
"quake": "#882233",
|
||||
"r": "#198ce7",
|
||||
"racket": "#3c5caa",
|
||||
"ragel": "#9d5200",
|
||||
"raku": "#0000fb",
|
||||
"raml": "#77d9fb",
|
||||
"rascal": "#fffaa0",
|
||||
"reason": "#ff5847",
|
||||
"rebol": "#358a5b",
|
||||
"record jar": "#0673ba",
|
||||
"red": "#f50000",
|
||||
"ren'py": "#ff7f7f",
|
||||
"rescript": "#ed5051",
|
||||
"ring": "#2d54cb",
|
||||
"riot": "#a71e49",
|
||||
"roff": "#ecdebe",
|
||||
"rouge": "#cc0088",
|
||||
"ruby": "#701516",
|
||||
"runoff": "#665a4e",
|
||||
"rust": "#dea584",
|
||||
"saltstack": "#646464",
|
||||
"sas": "#b34936",
|
||||
"sass": "#a53b70",
|
||||
"scala": "#c22d40",
|
||||
"scaml": "#bd181a",
|
||||
"scheme": "#1e4aec",
|
||||
"scss": "#c6538c",
|
||||
"sed": "#64b970",
|
||||
"self": "#0579aa",
|
||||
"shell": "#89e051",
|
||||
"shen": "#120f14",
|
||||
"slash": "#007eff",
|
||||
"slice": "#003fa2",
|
||||
"slim": "#2b2b2b",
|
||||
"smalltalk": "#596706",
|
||||
"smpl": "#c94949",
|
||||
"solidity": "#aa6746",
|
||||
"sourcepawn": "#f69e1d",
|
||||
"sqf": "#3f3f3f",
|
||||
"squirrel": "#800000",
|
||||
"srecode template": "#348a34",
|
||||
"stan": "#b2011d",
|
||||
"standard ml": "#dc566d",
|
||||
"starlark": "#76d275",
|
||||
"stylus": "#ff6347",
|
||||
"supercollider": "#46390b",
|
||||
"svelte": "#ff3e00",
|
||||
"svg": "#ff9900",
|
||||
"swift": "#ffac45",
|
||||
"systemverilog": "#dae1c2",
|
||||
"tcl": "#e4cc98",
|
||||
"terra": "#00004c",
|
||||
"tex": "#3d6117",
|
||||
"ti program": "#a0aa87",
|
||||
"turing": "#cf142b",
|
||||
"twig": "#c1d026",
|
||||
"typescript": "#2b7489",
|
||||
"unified parallel c": "#4e3617",
|
||||
"uno": "#9933cc",
|
||||
"unrealscript": "#a54c4d",
|
||||
"v": "#4f87c4",
|
||||
"vala": "#fbe5cd",
|
||||
"vba": "#867db1",
|
||||
"vbscript": "#15dcdc",
|
||||
"vcl": "#148aa8",
|
||||
"verilog": "#b2b7f8",
|
||||
"vhdl": "#adb2cb",
|
||||
"vim script": "#199f4b",
|
||||
"visual basic .net": "#945db7",
|
||||
"volt": "#1f1f1f",
|
||||
"vue": "#2c3e50",
|
||||
"wdl": "#42f1f4",
|
||||
"webassembly": "#04133b",
|
||||
"wisp": "#7582d1",
|
||||
"wollok": "#a23738",
|
||||
"x10": "#4b6bef",
|
||||
"xbase": "#403a40",
|
||||
"xc": "#99da07",
|
||||
"xquery": "#5232e7",
|
||||
"xslt": "#eb8ceb",
|
||||
"yacc": "#4b6c4b",
|
||||
"yaml": "#cb171e",
|
||||
"yara": "#220000",
|
||||
"yasnippet": "#32ab90",
|
||||
"zap": "#0d665e",
|
||||
"zenscript": "#00bcd1",
|
||||
"zephir": "#118f9e",
|
||||
"zig": "#ec915c",
|
||||
"zil": "#dc75e5",
|
||||
}
|
||||
Reference in New Issue
Block a user