Commits

ryanackley committed 01bd34f

Working shakuni workflow

Comments (0)

Files changed (3)

         <script src="SimpleWebServerConfig.js"></script>
 		<script src="AtlassianPluginProject.js"></script>
 		<script src="FileUrlProject.js"></script>
+		<script src="shakuni/ShakuniProject.js"></script>
 		<script src="zepto1.0rc1.js"></script>
 		<script src="RecentUpdateHandler.js"></script>
 		<script src="FileWatcher.js"></script>
   "background": {"page" :"background.html"},
   "icons": {"48": "tools_small.png",
             "128": "tools.png" },
-  "permissions": ["http://*/", "https://*/"],
+  "permissions": ["webRequest", "webRequestBlocking","<all_urls>", "http://*/", "https://*/"],
   "plugins": [
     { "path": "NPAPIFileIOforChrome.plugin", "public": false },
     { "path": "npNPAPIFileIOforChrome.dll", "public": false },

shakuni/ShakuniProject.js

+
+
+ProjectTypes.push(
+    {
+		name: 'Shakuni',
+		key: 'atlassian.shakuni',
+		locationType : 'local',
+		createProject : function(root, url, callback){
+			// parseUri 1.2.2
+		    // (c) Steven Levithan <stevenlevithan.com>
+		    // MIT License
+		    // function parseUri (str) {
+		    //     var o   = parseUri.options,
+		    //     m   = o.parser[o.strictMode ? "strict" : "loose"].exec(str),
+		    //     uri = {},
+		    //     i   = 14;
+
+		    //     while (i--) uri[o.key[i]] = m[i] || "";
+
+		    //     uri[o.q.name] = {};
+		    //     uri[o.key[12]].replace(o.q.parser, function ($0, $1, $2) {
+		    //         if ($1) uri[o.q.name][$1] = $2;
+		    //     });
+
+		    //     return uri;
+		    // }
+		    // parseUri.options = {
+		    //     strictMode: false,
+		    //     key: ["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"],
+		    //     q:   {
+		    //         name:   "queryKey",
+		    //         parser: /(?:^|&)([^&=]*)=?([^&]*)/g
+		    //     },
+		    //     parser: {
+		    //         strict: /^(?:([^:\/?#]+):)?(?:\/\/((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:\/?#]*)(?::(\d*))?))?((((?:[^?#\/]*\/)*)([^?#]*))(?:\?([^#]*))?(?:#(.*))?)/,
+		    //         loose:  /^(?:(?![^:@]+:[^:@\/]*@)([^:\/?#.]+):)?(?:\/\/)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/
+		    //     }
+		    // };	
+
+			// var uri = parseUri(url);
+			// var path = '/';
+			// if (uri.directory.indexOf('/jira') == 0){
+			// 	path = '/jira';
+			// }
+			// else if (uri.directory.indexOf('/confluence') == 0){
+			// 	path = '/confluence';
+			// }
+			// else if (uri.directory.indexOf('/wiki') == 0){
+			// 	path = '/wiki';
+			// }
+			// var baseUrl = uri.protocol  + '://' + uri.authority + path;
+
+			var baseUrl = 'http://localhost:8000/';
+
+			config = {
+					toFile : [
+						{from: 'http\\://localhost:8000/(.+\\.js)',
+						 to: '/$1'},
+						{from: 'http\\://localhost:8000/(.+\\.css)',
+						 to: '/$1'}
+					],
+					fromFile : []
+			};
+
+			var project = new ConfigFileBasedProject(config, root, baseUrl);
+
+			chrome.webRequest.onBeforeRequest.addListener(
+	  			function(details){
+	  				var match = details.url.match('/experimental/(.+\\.(js|css|jpg|jpeg|png))'); 
+	  				if (match)
+	  				{
+	  					return {redirectUrl: 'http://localhost:8000/' + match[1]};
+	  				}
+	  				// var filePath = project.filePathForUrl(details.url);
+	  				// if (filePath){
+	  				// 	var binaryData = window.nativeFileSupport.contentsAtPath(filePath);
+	  				// 	var binaryStr = new Array(binaryData.length);
+	  				// 	var i = binaryData.length;
+	  				// 	while (i--){
+	  				// 		binaryStr[i] = String.fromCharCode(binaryData[i]);
+	  				// 	}
+
+	  				// 	var mimeType = 'text/javascript';
+	  				// 	if (filePath.indexOf('.css') == filePath.length - 4){
+	  				// 		mimeType = 'text/css';
+	  				// 	}
+	  				// 	else if (filePath.indexOf('.png') == filePath.length - 4){
+	  				// 		mimeType = 'image/png';
+	  				// 	}
+	  				// 	else if (filePath.indexOf('.jpg') == filePath.length - 4 || filePath.indexOf('.jpeg') == filePath.length - 5){
+	  				// 		mimeType = 'image/jpeg';
+	  				// 	}
+
+	  				// 	var dataUrl = 'data:' + mimeType + ';' + 'base64,' + btoa(binaryStr.join(''));
+
+	  				// 	return {redirectUrl: dataUrl};
+	  				// }
+	  				else{
+	  					return {cancel:false};
+	  				}
+	  			}, 
+	  			{
+	  				urls: [url + '/*/experimental/*'],
+	  				types:  ["stylesheet", "script", "image"]
+  				}, ['blocking']);
+			
+			
+			
+			callback(project);
+		} 
+    }
+);
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.