Source

tincr / editorpanel.html

<html>
<head>
	<link rel="stylesheet" type="text/css" href="editorpanel.css" />

	<script src="zepto1.0rc1.js"></script>
	<script src="BackgroundMsgSupport.js"></script>
	<script src="Logger.js"></script>
	<script>
		
		var projectTypes;
		
		var checkProjectState = function(){
			var projectState = window.devtoolsWindow.projectState;
				
			if (projectState.type == 'fileUrl'){
				$('#project-type').attr('disabled', 'true');
				$('#native-browse').attr('disabled', 'true');
			}
			else if (projectState.type){
				var typeSelect = document.getElementById('project-type');
				$('#project-type').removeAttr('disabled');
				$('#native-browse').removeAttr('disabled');
				
				for (var i = 0; i < projectTypes.length; i++){
					if (projectTypes[i].key === projectState.type){
						typeSelect.selectedIndex = i;
						break;
					}
				}
				$('#local-file-path').text(projectState.path);
			}
			
		}
		
		var initUI = function(){
			var typeSelect = document.getElementById('project-type');
			
			backgroundMsgSupport.getProjectTypes(function(types){
				projectTypes = types;
				for (var i = 0; i < projectTypes.length; ++i) {
					var projectType = projectTypes[i];
					typeSelect.add(new Option(projectType.name, i));
				}
				checkProjectState();
			});
			$(typeSelect).on('change', function(e){
				var index = typeSelect.selectedIndex;
				var projectType = projectTypes[index];
				if (projectType.locationType = 'local'){
					var fileSelect = document.getElementById('file-select');
					fileSelect.style.display = '';
				}
			});
			$('#native-browse').on('click', function(e){
				var index = typeSelect.selectedIndex;
				backgroundMsgSupport.launchFileSelect(index, window.devtoolsWindow.inspectedLocation.href, function(result){
					if (result.path && result.path.length){
						$('#local-file-path').text(result.path);
						if (result.error){
							logError(result.error);
						}
						else{
							var projectType = projectTypes[index];
							window.devtoolsWindow.loadProject(projectType.key, result.path);
						}
					}
				});
			});
		};
	</script>
</head>
<body>
	<div id="project-select-form">
		<p>
			<fieldset>
				<label>Project Type:</label>
				<select id="project-type"></select>
			</fieldset>
		</p>
		<p id="file-select" style="display:none">
			<fieldset>
				<label>Root Directory</label><label id="local-file-path"></label>
				<button id="native-browse">Browse</button>
			</fieldset>
		</p>
	</div>
</body>
</html>
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.