Skip to content

Commit

Permalink
Merge branch 'master' of github.com:yusufnb/pivotate
Browse files Browse the repository at this point in the history
  • Loading branch information
cleberar committed Feb 27, 2019
2 parents 3dafa97 + dcf9271 commit befe0de
Show file tree
Hide file tree
Showing 12 changed files with 430 additions and 337 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
[![Gitter](https://badges.gitter.im/Join Chat.svg)](https://gitter.im/cleberar/pivotate?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)

Can be installed from:
https://chrome.google.com/webstore/detail/pivotate/lciiccjdlhnedcpdpelgmddkjbnbjbja
https://chrome.google.com/webstore/detail/pivotate-v5/eljfphonhnilcfpkbdhigiahjpcbecic


Extension originally created by https://github.com/latentflip
Extension originally created by https://github.com/latentflip
18 changes: 16 additions & 2 deletions background.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
var id = 100;
chrome.browserAction.onClicked.addListener(function(tab) {
chrome.tabs.captureVisibleTab(null, function(screenshotUrl) {
var url = '';

chrome.runtime.onMessage.addListener(openPivotate);


function openPivotate(request, sender, sendResponse) {
chrome.tabs.captureVisibleTab(function(screenshotUrl) {
var currentId = id++;
var viewTabUrl = chrome.extension.getURL('pivotate.html?id=' + (currentId));
chrome.tabs.create({url: viewTabUrl}, function(tab) {
Expand All @@ -15,6 +20,7 @@ chrome.browserAction.onClicked.addListener(function(tab) {
for (var i = 0; i < views.length; i++) {
var view = views[i];
if (view.location.href == viewTabUrl) {
view.pivotate.setTabData({url: request.location.href});
view.pivotate.setScreenShot(screenshotUrl, currentId);
break;
}
Expand All @@ -23,4 +29,12 @@ chrome.browserAction.onClicked.addListener(function(tab) {
chrome.tabs.onUpdated.addListener(addSnapshotImageToTab);
});
});

}

chrome.browserAction.onClicked.addListener(function(tab) {
chrome.tabs.executeScript({
// Dummy code for future use
code: 'chrome.runtime.sendMessage({location: window.location})'
});
});
Binary file added chosen-sprite.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions chosen.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions chosen.jquery.js

Large diffs are not rendered by default.

Binary file modified cursor.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
70 changes: 70 additions & 0 deletions jquery-ajax-blob-arraybuffer.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
/**
* Register ajax transports for blob send/recieve and array buffer send/receive via XMLHttpRequest Level 2
* within the comfortable framework of the jquery ajax request, with full support for promises.
*
* Notice the +* in the dataType string? The + indicates we want this transport to be prepended to the list
* of potential transports (so it gets first dibs if the request passes the conditions within to provide the
* ajax transport, preventing the standard transport from hogging the request), and the * indicates that
* potentially any request with any dataType might want to use the transports provided herein.
*
* Remember to specify 'processData:false' in the ajax options when attempting to send a blob or arraybuffer -
* otherwise jquery will try (and fail) to convert the blob or buffer into a query string.
*/
$.ajaxTransport("+*", function(options, originalOptions, jqXHR){
// Test for the conditions that mean we can/want to send/receive blobs or arraybuffers - we need XMLHttpRequest
// level 2 (so feature-detect against window.FormData), feature detect against window.Blob or window.ArrayBuffer,
// and then check to see if the dataType is blob/arraybuffer or the data itself is a Blob/ArrayBuffer
if (window.FormData && ((options.dataType && (options.dataType === 'blob' || options.dataType === 'arraybuffer')) ||
(options.data && ((window.Blob && options.data instanceof Blob) ||
(window.ArrayBuffer && options.data instanceof ArrayBuffer)))
))
{
return {
/**
* Return a transport capable of sending and/or receiving blobs - in this case, we instantiate
* a new XMLHttpRequest and use it to actually perform the request, and funnel the result back
* into the jquery complete callback (such as the success function, done blocks, etc.)
*
* @param headers
* @param completeCallback
*/
send: function(headers, completeCallback){
var xhr = new XMLHttpRequest(),
url = options.url || window.location.href,
type = options.type || 'GET',
dataType = options.dataType || 'text',
data = options.data || null,
async = options.async || true,
key;

xhr.addEventListener('load', function(){
var response = {}, status, isSuccess;

isSuccess = xhr.status >= 200 && xhr.status < 300 || xhr.status === 304;

if (isSuccess) {
response[dataType] = xhr.response;
} else {
// In case an error occured we assume that the response body contains
// text data - so let's convert the binary data to a string which we can
// pass to the complete callback.
response.text = String.fromCharCode.apply(null, new Uint8Array(xhr.response));
}

completeCallback(xhr.status, xhr.statusText, response, xhr.getAllResponseHeaders());
});

xhr.open(type, url, async);
xhr.responseType = dataType;

for (key in headers) {
if (headers.hasOwnProperty(key)) xhr.setRequestHeader(key, headers[key]);
}
xhr.send(data);
},
abort: function(){
jqXHR.abort();
}
};
}
});
4 changes: 4 additions & 0 deletions jquery.js

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions manifest.json
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
{
"name": "Pivotate",
"version": "1.9",
"name": "Pivotate v5",
"version": "2.4",
"description": "Submit to Pivotal Tracker with screenshot",
"background": {
"persistent": false,
"scripts": ["background.js"]
},
"browser_action": {
"default_icon": "icon-19.png",
"default_title": "Pivotal Submit!"
"default_title": "Add Pivotal Story"
},
"icons":{
"128":"icon-128.png",
"48" :"icon-48.png",
"16" :"icon-16.png"
},
"permissions": [ "<all_urls>", "http://*/", "https://*/", "https://www.pivotaltracker.com/services/v3/*", "tabs" ],
"permissions": [ "activeTab", "<all_urls>", "http://*/", "https://*/", "https://www.pivotaltracker.com/services/v3/*", "https://www.pivotaltracker.com/services/v5/*", "tabs" ],
"manifest_version": 2,
"content_security_policy": "script-src 'self' https://ssl.google-analytics.com; object-src 'self'"
}
Loading

0 comments on commit befe0de

Please sign in to comment.