Skip to content

Commit

Permalink
Updated for new multiple account config
Browse files Browse the repository at this point in the history
Still need to add each areas personal Exclude/Include List and Global
Exclude/Include/Priority List
  • Loading branch information
RedSparr0w committed Aug 7, 2016
1 parent a5f3849 commit 23c985f
Showing 1 changed file with 76 additions and 24 deletions.
100 changes: 76 additions & 24 deletions ConfigGenerator.html
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,20 @@
$scope.color = ["#2ecc71","#3498db","#9b59b6","#e74c3c","#1abc9c","#e67e22","#f1c40f"];
$scope.total = 0;
$scope.setConfig = function(){
$scope.configuration = JSON.parse(localStorage.getItem("Configuration")) || {"PTCUsername":"","PTCPassword":"","GAUsername":"","GAPassword":"","TwitterConsumerToken":"CONSUMERKEY","TwitterConsumerSecret":"CONSUMERSECRET","TwitterAccessToken":"ACCESSTOKEN","TwitterAccessSecret":"ACCESSSECRET","RateLimit":0,"MinimumLifeExpectancy":300,"ExcludedPokemon":[10,11,13,14,15,16,17,18,19,20,21,22,23,29,30,32,33,35,39,41,42,43,46,47,48,49,52,54,56,60,63,69,72,73,74,86,90,92,96,98,100,116,118,120,125,129,133],"PriorityPokemon":[3,6,9,26,38,59,62,65,68,78,80,94,103,105,106,107,112,113,115,122,130,131,132,142,143,144,145,146,149,150,151],"TagPokemon":true,"TagRegion":true,"CustomTags":["PokemonGo","Bellingham"],"RegularTweet":"A wild {0} appeared!\nIt will be {1} {2} {3} until {4}.\n{5}","PriorityTweet":"BREAKING NEWS!\n{0} has appeared {1} {2} {3}!\nHurry, it will vanish at {4}!\n{5}","PokemonOverrides":[{"Kind":16,"Display":"BirdBrain"},{"Kind":19,"Display":"BarneyMouse"}],"Regions":[{"Name":"Highschool","Prefix":"around the","Suffix":"","Locations":[{"Latitude":48.757564,"Longitude":-122.474716},{"Latitude":48.75755,"Longitude":-122.47183},{"Latitude":48.755315,"Longitude":-122.471862}],"Markers":[]},{"Name":"Downtown","Prefix":"in the","Suffix":"area","Locations":[{"Latitude":48.747813,"Longitude":-122.478256},{"Latitude":48.748513,"Longitude":-122.479576},{"Latitude":48.749277,"Longitude":-122.478138},{"Latitude":48.750331,"Longitude":-122.476668},{"Latitude":48.749831,"Longitude":-122.474853}],"Markers":[]},{"Name":"Aslan Brewing","Prefix":"near the","Suffix":"Company","Locations":[{"Latitude":48.748414,"Longitude":-122.474694}],"Markers":[]}]};
$scope.configuration = JSON.parse(localStorage.getItem("Configuration")) || {"PoGoAccounts": [{"PTCUsername":"","PTCPassword":"","GAUsername":"","GAPassword":""}],"TwitterConsumerToken":"CONSUMERKEY","TwitterConsumerSecret":"CONSUMERSECRET","TwitterAccessToken":"ACCESSTOKEN","TwitterAccessSecret":"ACCESSSECRET","RateLimit":0,"MinimumLifeExpectancy":300,"ExcludedPokemon":[10,11,13,14,15,16,17,18,19,20,21,22,23,29,30,32,33,35,39,41,42,43,46,47,48,49,52,54,56,60,63,69,72,73,74,86,90,92,96,98,100,116,118,120,125,129,133],"PriorityPokemon":[3,6,9,26,38,59,62,65,68,78,80,94,103,105,106,107,112,113,115,122,130,131,132,142,143,144,145,146,149,150,151],"TagPokemon":true,"TagRegion":true,"CustomTags":["PokemonGo","Bellingham"],"RegularTweet":"A wild {0} appeared!\nIt will be {1} {2} {3} until {4}.\n{5}","PriorityTweet":"BREAKING NEWS!\n{0} has appeared {1} {2} {3}!\nHurry, it will vanish at {4}!\n{5}","PokemonOverrides":[{"Kind":16,"Display":"BirdBrain"},{"Kind":19,"Display":"BarneyMouse"}],"Regions":[{"Name":"Highschool","Prefix":"around the","Suffix":"","Locations":[{"Latitude":48.757564,"Longitude":-122.474716},{"Latitude":48.75755,"Longitude":-122.47183},{"Latitude":48.755315,"Longitude":-122.471862}],"Markers":[]},{"Name":"Downtown","Prefix":"in the","Suffix":"area","Locations":[{"Latitude":48.747813,"Longitude":-122.478256},{"Latitude":48.748513,"Longitude":-122.479576},{"Latitude":48.749277,"Longitude":-122.478138},{"Latitude":48.750331,"Longitude":-122.476668},{"Latitude":48.749831,"Longitude":-122.474853}],"Markers":[]},{"Name":"Aslan Brewing","Prefix":"near the","Suffix":"Company","Locations":[{"Latitude":48.748414,"Longitude":-122.474694}],"Markers":[]}]};
if ( !$scope.configuration.hasOwnProperty("PoGoAccounts") ){
$scope.configuration.PoGoAccounts=[];
$scope.configuration.PoGoAccounts.push({
PTCUsername:$scope.configuration.PTCUsername,
PTCPassword:$scope.configuration.PTCPassword,
GAUsername:$scope.configuration.GAUsername,
GAPassword:$scope.configuration.GAPassword
});
delete $scope.configuration.PTCUsername;
delete $scope.configuration.PTCPassword;
delete $scope.configuration.GAUsername;
delete $scope.configuration.GAPassword;
}
$scope.setLocation();
$('textarea').trigger('autoresize');
}
Expand Down Expand Up @@ -125,6 +138,17 @@
$scope.configuration.Regions.splice(this.$index, 1);
$scope.setLocation();
}
$scope.AddAccount = function () {
$scope.configuration.PoGoAccounts.push({
PTCUsername:"",
PTCPassword:"",
GAUsername:"",
GAPassword:""
});
};
$scope.RemoveAccount = function() {
$scope.configuration.PoGoAccounts.splice(this.$index, 1);
}
//Add Single Marker
$scope.addNewMarker = function(Lat,Lng,area) {
Lat = Lat || 0;
Expand Down Expand Up @@ -168,12 +192,14 @@
var Index = this.$index;
var bounds = $scope.rectangle.getBounds();
var i=0;
for (nextS = bounds.f.b; (nextS + (180/Math.PI)*(105/6378137)) > bounds.f.f; nextS -= (180/Math.PI)*(105/6378137)){
var moveE = 160;
var moveS = moveE*0.7;
for (nextS = bounds.f.b; (nextS + (180/Math.PI)*((moveS/2)/6378137)) > bounds.f.f; nextS -= (180/Math.PI)*(moveS/6378137)){
nextEE = bounds.b.b;
if (++i % 2 == 0){
nextEE += (180/Math.PI)*(80/6378137)
nextEE += (180/Math.PI)*((moveE/2)/6378137)
}
for (nextE = nextEE; (nextE - (180/Math.PI)*(80/6378137)) < bounds.b.f; nextE += (180/Math.PI)*(160/6378137)){
for (nextE = nextEE; (nextE - (180/Math.PI)*((moveE/2)/6378137)) < bounds.b.f; nextE += (180/Math.PI)*(moveE/6378137)){
$scope.addNewMarker(nextS,nextE,Index);
}
}
Expand Down Expand Up @@ -213,9 +239,13 @@
mark.setMap(null);
});
v.Markers = [];
delete v["$$hashKey"];
});
localStorage.setItem("Configuration",JSON.stringify($scope.configuration));
localStorage.setItem("Configuration",JSON.stringify($scope.configuration,function( key, value ) {
if( key === "$$hashKey" ) {
return undefined;
}
return value;
}));
}
$scope.setLocation = function(){
$scope.save();
Expand Down Expand Up @@ -292,6 +322,19 @@
lines = e.target.result;
$scope.save();
$scope.configuration = JSON.parse(lines) || $scope.configuration;
if ( !$scope.configuration.hasOwnProperty("PoGoAccounts") ){
$scope.configuration.PoGoAccounts=[];
$scope.configuration.PoGoAccounts.push({
PTCUsername:$scope.configuration.PTCUsername,
PTCPassword:$scope.configuration.PTCPassword,
GAUsername:$scope.configuration.GAUsername,
GAPassword:$scope.configuration.GAPassword
});
delete $scope.configuration.PTCUsername;
delete $scope.configuration.PTCPassword;
delete $scope.configuration.GAUsername;
delete $scope.configuration.GAPassword;
}
$scope.setLocation();
try{
$('textarea').trigger('autoresize');
Expand Down Expand Up @@ -469,24 +512,33 @@
<div class="container" id="menu" style="max-height:100vh;overflow-y:auto;autoflow-x:hidden;">
<ul class="collapsible popout" data-collapsible="accordion">
<li>
<div class="collapsible-header"><i class="material-icons">supervisor_account</i>Pokemon GO Account</div>
<div class="collapsible-header"><i class="material-icons">supervisor_account</i>Pokemon GO Account's</div>
<div class="collapsible-body">
<div class="input-field col s12">
<input autocomplete="off" placeholder="(optional)" id="PTCUsername" type="text" ng-model="configuration.PTCUsername">
<label for="PTCUsername" class="active">PTC Username</label>
</div>
<div class="input-field col s12">
<input autocomplete="off" placeholder="********" id="PTCPassword" type="password" ng-model="configuration.PTCPassword">
<label for="PTCPassword" class="active">PTC Password</label>
</div>
<div class="input-field col s12">
<input autocomplete="off" placeholder="(optional)" id="google_username" type="text" ng-model="configuration.GAUsername">
<label for="GAUsername" class="active">Google Account Username</label>
</div>
<div class="input-field col s12">
<input autocomplete="off" placeholder="********" id="ptc_username" type="password" ng-model="configuration.GAPassword">
<label for="GAUsername" class="active">Google Account Password</label>
</div>
<ul class="collapsible" data-collapsible="accordion">
<li ng-repeat="account in configuration.PoGoAccounts">
<div class="collapsible-header truncate">{{ ( account.PTCUsername ? account.PTCUsername : ( account.GAUsername ? account.GAUsername : "Account "+($index+1) ) ) }}</div>
<div class="collapsible-body">
<div class="input-field col s12">
<input autocomplete="off" placeholder="(optional)" id="PTCUsername" type="text" ng-model="account.PTCUsername">
<label for="PTCUsername" class="active">PTC Username</label>
</div>
<div class="input-field col s12">
<input autocomplete="off" placeholder="********" id="PTCPassword" type="password" ng-model="account.PTCPassword">
<label for="PTCPassword" class="active">PTC Password</label>
</div>
<div class="input-field col s12">
<input autocomplete="off" placeholder="(optional)" id="google_username" type="text" ng-model="account.GAUsername">
<label for="GAUsername" class="active">Google Account Username</label>
</div>
<div class="input-field col s12">
<input autocomplete="off" placeholder="********" id="ptc_username" type="password" ng-model="account.GAPassword">
<label for="GAUsername" class="active">Google Account Password</label>
</div>
<a class="waves-effect waves-light btn red" data-ng-click="RemoveAccount()">Remove</a>
</div>
</li>
</ul>
<a class="waves-effect waves-light btn blue-grey darken-4" data-ng-click="AddAccount()">Add Account</a>
</div>
</li>
<li>
Expand Down Expand Up @@ -554,7 +606,7 @@
<a class="btn" data-ng-click="priorityTweet()" style="margin-bottom:10px;">Priority Example</a>
<div class="input-field col s12">
<textarea id="PriorityTweet" class="materialize-textarea" ng-model="configuration.CustomTags" ng-list="&#10;" ng-trim="false" style="margin:0px;"></textarea>
<label for="CustomTags" class="active">Custom Tags (1 per line)</label>
<label for="CustomTags" class="active">Custom Hashtags (1 per line)</label>
</div>
<p class="range-field">
Min Seconds Between Tweets:
Expand Down

0 comments on commit 23c985f

Please sign in to comment.