aboutsummaryrefslogtreecommitdiff
path: root/redirector.html
blob: aa0ccbc59a8122dd62fbb2bb5d734d27bd5fadac (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
<!DOCTYPE html>
<html>
	<head>
		<title>Redirector</title>
		<link rel="stylesheet" href="css/redirector.css" />
		<meta charset="UTF-8">
		<script src="js/angular.min.js"></script>
		<script src="js/redirect.js"></script>
		<script src="js/app.js"></script>
	</head>
	<body ng-app="redirectorApp" ng-controller="redirectorController">
		<div id="cover" ng-show="showModal">
		</div>
		<div id="delete-redirect-form" ng-show="deleting">
			<h3>Are you sure you want to delete this redirect?</h3>
			<div>
				<label>Description:</label>
				<span>{{deleting.description}}</span>
			</div>
			<div>
				<label>Example URL:</label>
				<span>{{deleting.exampleUrl}}</span>
			</div>
			<div>
				<label>Include pattern:</label>
				<span>{{deleting.includePattern}}
			</div>
			<div>
				<label>Redirect to:</label>
				<span>{{deleting.redirectUrl}}</span>
			</div>
			<div>
				<label>Pattern type:</label>
				<span>{{deleting.patternType == 'W' ? 'Wildcard' : 'Regular Expression'}}</span>
			</div>			
			<div class="button-container">
				<a class="btn red large" ng-click="deleteRedirect()">Yes, delete it</a>
				<a class="btn grey large" ng-click="cancelDelete()">No, don't delete it</a>
			</div>
		</div>
		<div id="edit-redirect-form" ng-show="activeRedirect">
			<h3>{{editIndex >= 0 ? 'Edit' : 'Create'}} Redirect</h3>
			<div>
				<label>Description:</label>
				<input type="text" ng-model="activeRedirect.description" placeholder="Enter a description for your redirect rule" />
			</div>
			<div>
				<label>Example URL:</label>
				<input type="text" ng-model="activeRedirect.exampleUrl" placeholder="http://example.com/some/path?a=1" />
			</div>
			<div>
				<label>Include pattern:</label>
				<input type="text" ng-model="activeRedirect.includePattern" placeholder="Pattern that matches the urls you want to redirect" />
			</div>
			<div>
				<label>Redirect to:</label>
				<input type="text" ng-model="activeRedirect.redirectUrl" placeholder="The url you want to redirect requests to" />
			</div>
			<div>
				<label>Pattern type:</label>
				<label id="wildcardtype"><input type="radio" ng-model="activeRedirect.patternType" name="patterntype" value="W">Wildcard</label>
				<label><input type="radio" ng-model="activeRedirect.patternType" name="patterntype" value="R">Regular Expression</label>
			</div>
			<div>
				<label>Example result:</label>
			</div>
			<div id="advanced-toggle">
				<a ng-click="showAdvanced=true" ng-show="!showAdvanced">Show advanced options...</a>
				<a ng-click="showAdvanced=false" ng-show="showAdvanced">Hide advanced options...</a>
			</div>
			<div id="advanced" ng-show="showAdvanced">
				<div>
					<label>Exclude pattern:</label>
					<input type="text" ng-model="activeRedirect.excludePattern" placeholder="Pattern to exclude certain urls from the redirection"/>
				</div>
				<div>
					<label for="unescape-matches">Unescape matches:</label>
					<input id="unescape-matches" ng-model="activeRedirect.unescapeMatches" type="checkbox">
				</div>	
				<div>
					<label for="escape-matches">Escape matches:</label>
					<input id="escape-matches" ng-model="activeRedirect.escapeMatches" type="checkbox">
				</div>
				<div>
					<label>Apply to:</label>

					<label ng-repeat="(key,value) in requestTypes " ng-class="{'second-column' : !$first}"><input type="checkbox" ng-checked="appliesTo(key)" ng-click="toggleApplies(key)">{{value}}</label>

				</div>
			</div>
			<div class="button-container">
				<a class="btn green medium" ng-click="saveRedirect()">Save</a>
				<a class="btn red medium" ng-click="cancelEdit()">Cancel</a>
			</div>
		</div>


		<div id="blur-wrapper" ng-class="{blur: showModal}">
			<h1>Redirector</h1>
			<!--<h3>DISABLED</h3>-->
			<h5>Go where <em>YOU</em> want!</h5>


			<div id="menu">
				<input type="file" id="import-file" fileselected="importRedirects($file)" accept=".rjson,.json,.txt,text/*"  />
				<a class="btn blue large" ng-click="createNew()">Create new redirect</a>
				<label for="import-file" class="btn blue large">Import</label>
				<a class="btn blue large" ng-href="{{redirectDownload}}" download="Redirector.rjson">Export</a>
				<a class="btn blue large" href="help.html" target="_blank">Help</a>
			</div>

			<div id="message-box" ng-class="{visible : message, error : messageType == 'error', success : messageType == 'success'}">
				{{message}}
				<a ng-click="message=null">&#x2716;</a>
			</div>
			<div class="redirect-table">
				<div class="redirect-row" ng-class="{disabled: r.disabled}" ng-repeat="r in redirects">
					<h4><span class="disabled-marker" ng-show="r.disabled">[Disabled] </span><span>{{r.description}}</span></h4>
					<div>
						<label>Redirect:</label> <span>{{r.includePattern}}</span>
					</div>
					<div>
						<label>to:</label> <span>foo.is</span>
					</div>
					<div ng-show="r.excludePattern">
						<label>excluding:</label> <span>asdfasdf</span>
					</div>
					<div>
						<label>Example:</label> <span></span>
					</div>
					<div>
						<label>Applies to:</label> <span>{{r.appliesTo|requestTypeDisplay}}</span>
					</div>
					<div>
						<a class="btn blue" ng-click="toggleDisabled(r)">{{r.disabled ? "Enable" : "Disable"}}</a>
						<a class="btn green" ng-click="editRedirect($index)">Edit</a>
						<a class="btn red" ng-click="confirmDelete($index)">Delete</a>
						<a class="btn grey move-up-btn" ng-class="{disabled:$first}" ng-click="moveUp($index)"></a>
						<a class="btn grey move-down-btn" ng-class="{disabled:$last}" ng-click="moveDown($index)"></a>
					</div>
				</div>
			</div>
			<footer>
				<small>Redirector is created by <a target="_blank" href="http://einaregilsson.com">Einar Egilsson</a></small>
			</footer>
		</div>
	</body>
</html>