Cqb Listusers

Try to fetch a wiki page
If we can access the current user (name at the top of the page) then use ListPages to get current author
If we can't, try to fetch the current page, work out the author, and then use ListUsers to get current user

This is your name:


Codebase

HTML

<html ng-app="main" ng-controller="MainController" id="html">
<head>
    <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.7.2/angular.min.js"></script>
    <script src="http://scp-sandbox-3.wikidot.com/local--code/cqb-listusers/2"></script>
    <link href="http://d3g0gp89917ko0.cloudfront.net/v--edac79f846ba/common--theme/base/css/style.css" rel="stylesheet">
    <link href="http://www.scp-wiki.net/component:theme/code/1" rel="stylesheet">
    <link href="http://scp-sandbox-3.wikidot.com/local--code/cqb-listusers/4" rel="stylesheet">
</head>
<body>
    <div class="wrapper">
        <div class="carousel">
            <p id="name">Username</p>
        </div>
    </div>
</body>
</html>

JS

function getQueryVariable(variable) {
    var query = document.location.href.match(/\?.*$/g)[0].substring(1);
    var vars = query.split("&");
    for(var i = 0; i < vars.length; i++) { // >
        var pair = vars[i].split("=");
        if(pair[0] === variable) return pair[1]; 
    }
    return false;
}
 
(function(){
    var main = angular
        .module('main',[])
        .controller('MainController',MainController);
 
    MainController.$inject = ['$scope','$timeout'];
    function MainController($scope,$timeout){
        var username = getQueryVariable("username");
        document.getElementById("name").textContent = username;
    }
})();