Skip to content

Commit

Permalink
Generated code
Browse files Browse the repository at this point in the history
  • Loading branch information
mastef committed Sep 22, 2024
1 parent c08d72e commit 3115819
Show file tree
Hide file tree
Showing 9 changed files with 9,674 additions and 414 deletions.
58 changes: 29 additions & 29 deletions outlib/Session.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
"use strict";var _createClass = function () {function defineProperties(target, props) {for (var i = 0; i < props.length; i++) {var descriptor = props[i];descriptor.enumerable = descriptor.enumerable || false;descriptor.configurable = true;if ("value" in descriptor) descriptor.writable = true;Object.defineProperty(target, descriptor.key, descriptor);}}return function (Constructor, protoProps, staticProps) {if (protoProps) defineProperties(Constructor.prototype, protoProps);if (staticProps) defineProperties(Constructor, staticProps);return Constructor;};}();function _asyncToGenerator(fn) {return function () {var gen = fn.apply(this, arguments);return new Promise(function (resolve, reject) {function step(key, arg) {try {var info = gen[key](arg);var value = info.value;} catch (error) {reject(error);return;}if (info.done) {resolve(value);} else {return Promise.resolve(value).then(function (value) {step("next", value);}, function (err) {step("throw", err);});}}return step("next");});};}function _classCallCheck(instance, Constructor) {if (!(instance instanceof Constructor)) {throw new TypeError("Cannot call a class as a function");}}function _possibleConstructorReturn(self, call) {if (!self) {throw new ReferenceError("this hasn't been initialised - super() hasn't been called");}return call && (typeof call === "object" || typeof call === "function") ? call : self;}function _inherits(subClass, superClass) {if (typeof superClass !== "function" && superClass !== null) {throw new TypeError("Super expression must either be null or a function, not " + typeof superClass);}subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } });if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;}var

Session = function (_React$Component) {_inherits(Session, _React$Component);
function Session(props) {_classCallCheck(this, Session);
function Session(props) {_classCallCheck(this, Session);var _this3 = _possibleConstructorReturn(this, (Session.__proto__ || Object.getPrototypeOf(Session)).call(this,
props));

//console.log(this.props.window);
//console.log(this.props.window.name);
var _this3 = _possibleConstructorReturn(this, (Session.__proto__ || Object.getPrototypeOf(Session)).call(this, props));var name = _this3.props.window.name;

var name = _this3.props.window.name;
_this3.state = {
windowTitles: [],
name: name,
Expand Down Expand Up @@ -123,19 +123,19 @@ Session = function (_React$Component) {_inherits(Session, _React$Component);
}
} }, { key: "shouldComponentUpdate", value: function shouldComponentUpdate(
nextProps, nextState) {
//console.log("should update?", nextProps, nextState);

return true;
} }, { key: "stop", value: function stop(
e) {
e.stopPropagation();
} }, { key: "windowClick", value: function () {var _ref = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(
} }, { key: "windowClick", value: function () {var _ref = _asyncToGenerator(regeneratorRuntime.mark(function _callee(
e) {var _this2, customName, whitelistWindow, whitelistTab, filteredWindow, newWindow, emptyTab, i, newTab, tabCreated, names;return regeneratorRuntime.wrap(function _callee$(_context) {while (1) {switch (_context.prev = _context.next) {case 0:
_this2 = this;
e.stopPropagation();
console.log("source window", this.props.window);
// chrome.runtime.getBackgroundPage(function callback(tabs, backgroundPage) {
// backgroundPage.createWindowWithTabs(tabs);
// }.bind(null, this.props.window.tabs));




customName = false;
if (this.props.window && this.props.window.name && this.props.window.customName) {
Expand Down Expand Up @@ -221,31 +221,31 @@ Session = function (_React$Component) {_inherits(Session, _React$Component);
setTimeout(function () {
this.props.scrollTo("window", newWindow.id);
}.bind(this), 250);
}
}case 32:case "end":return _context.stop();}}}, _callee, this);}));function windowClick(_x) {return _ref.apply(this, arguments);}return windowClick;}() }, { key: "close", value: function () {var _ref2 = _asyncToGenerator(regeneratorRuntime.mark(function _callee2(














// , function (tabs, w) {
// browser.tabs.create(first.id, { pinned: first.pinned });
// if (t.length > 0) {
// browser.tabs.move(t, { windowId: w.id, index: -1 }, function (tab) {
// browser.tabs.update(tab.id, { pinned: tab.pinned });
// });
// }
// browser.windows.update(w.id, { focused: true });
// }.bind(null, this.props.window.tabs));
// browser.windows.update(this.props.window.windowsInfo.id, {
// "focused": true },
// function (a) {this.props.parentUpdate();}.bind(this));
case 32:case "end":return _context.stop();}}}, _callee, this);}));function windowClick(_x) {return _ref.apply(this, arguments);}return windowClick;}() }, { key: "close", value: function () {var _ref2 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2(
e) {var value;return regeneratorRuntime.wrap(function _callee2$(_context2) {while (1) {switch (_context2.prev = _context2.next) {case 0:
e.stopPropagation();_context2.next = 3;return (
browser.storage.local.remove(this.props.window.id));case 3:value = _context2.sent;
console.log(value);
this.props.parentUpdate();
// browser.windows.remove(this.props.window.windowsInfo.id);
case 6:case "end":return _context2.stop();}}}, _callee2, this);}));function close(_x2) {return _ref2.apply(this, arguments);}return close;}() }, { key: "maximize", value: function maximize(
this.props.parentUpdate();case 6:case "end":return _context2.stop();}}}, _callee2, this);}));function close(_x2) {return _ref2.apply(this, arguments);}return close;}() }, { key: "maximize", value: function maximize(


e) {
e.stopPropagation();
// browser.windows.update(this.props.window.windowsInfo.id, {
// "state": "normal" },
// function (a) {this.props.parentUpdate();}.bind(this));



} }]);return Session;}(React.Component);
94 changes: 48 additions & 46 deletions outlib/Tab.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ Tab = function (_React$Component) {_inherits(Tab, _React$Component);

children.push(
React.createElement("div", { key: "tab-title-" + this.props.tab.id, className: "tabtitle" },
this.props.tab.title));
this.props.tab.title || ""));


}
Expand Down Expand Up @@ -108,38 +108,38 @@ Tab = function (_React$Component) {_inherits(Tab, _React$Component);
if (e.button === 0) return;
if (!this.props.drag) return;
this.click(e);
} }, { key: "click", value: function () {var _ref = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(
e) {var tabId, windowId, backgroundPage;return regeneratorRuntime.wrap(function _callee$(_context) {while (1) {switch (_context.prev = _context.next) {case 0:if (
} }, { key: "click", value: function () {var _ref = _asyncToGenerator(regeneratorRuntime.mark(function _callee(
e) {var tabId, windowId;return regeneratorRuntime.wrap(function _callee$(_context) {while (1) {switch (_context.prev = _context.next) {case 0:if (
this.props.drag) {_context.next = 2;break;}return _context.abrupt("return");case 2:
this.stopProp(e);

tabId = this.props.tab.id;
windowId = this.props.window.id;if (!(

e.button === 1)) {_context.next = 9;break;}
this.props.middleClick(tabId);_context.next = 19;break;case 9:if (!(
e.button === 2 || e.nativeEvent.metaKey || e.nativeEvent.altKey || e.nativeEvent.shiftKey || e.nativeEvent.ctrlKey)) {_context.next = 14;break;}
e.preventDefault();
if (e.button === 2 && (e.nativeEvent.metaKey || e.nativeEvent.altKey || e.nativeEvent.shiftKey || e.nativeEvent.ctrlKey)) {
this.props.selectTo(tabId);
windowId = this.props.window.id;

if (e.button === 1) {
this.props.middleClick(tabId);
} else if (e.button === 2 || e.nativeEvent.metaKey || e.nativeEvent.altKey || e.nativeEvent.shiftKey || e.nativeEvent.ctrlKey) {
e.preventDefault();
if (e.button === 2 && (e.nativeEvent.metaKey || e.nativeEvent.altKey || e.nativeEvent.shiftKey || e.nativeEvent.ctrlKey)) {
this.props.selectTo(tabId);
} else {
this.props.select(tabId);
}
} else {
this.props.select(tabId);
}_context.next = 19;break;case 14:_context.next = 16;return (
if (navigator.userAgent.search("Firefox") > -1) {
browser.runtime.sendMessage({ command: "focus_on_tab_and_window_delayed", tab: { id: tabId, windowId: windowId } });
} else {
browser.runtime.sendMessage({ command: "focus_on_tab_and_window", tab: { id: tabId, windowId: windowId } });
}

browser.runtime.getBackgroundPage());case 16:backgroundPage = _context.sent;
if (navigator.userAgent.search("Firefox") > -1) {
backgroundPage.focusOnTabAndWindowDelayed({ id: tabId, windowId: windowId });
} else {
backgroundPage.focusOnTabAndWindow({ id: tabId, windowId: windowId });
}
if (!!window.inPopup) window.close();case 19:return _context.abrupt("return",

false);case 20:case "end":return _context.stop();}}}, _callee, this);}));function click(_x) {return _ref.apply(this, arguments);}return click;}() }, { key: "dragStart", value: function dragStart(
if (!!window.inPopup) window.close();
}return _context.abrupt("return",
false);case 7:case "end":return _context.stop();}}}, _callee, this);}));function click(_x) {return _ref.apply(this, arguments);}return click;}() }, { key: "dragStart", value: function dragStart(

e) {
if (!!this.props.drag) {
e.dataTransfer.setData("Text", this.props.tab.id);
e.dataTransfer.setData("text/uri-list", this.props.tab.url);
e.dataTransfer.setData("text/uri-list", this.props.tab.url || "");
this.props.drag(e, this.props.tab.id);
} else {
return false;
Expand Down Expand Up @@ -170,32 +170,34 @@ Tab = function (_React$Component) {_inherits(Tab, _React$Component);
} else {
return false;
}
} }, { key: "resolveFavIconUrl", value: function () {var _ref2 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2() {var image, favIcons, iconName;return regeneratorRuntime.wrap(function _callee2$(_context2) {while (1) {switch (_context2.prev = _context2.next) {case 0:


// firefox screenshots; needs <all_urls>
// if(!!browser.tabs.captureTab) {
// console.log("tabs captureTab");
// image = await browser.tabs.captureTab(this.props.tab.id);
// image = "url(" + image + ")";
// }else
if (this.props.tab.url.indexOf("chrome://") !== 0 && this.props.tab.url.indexOf("about:") !== 0) {
// chrome screenshots / only for active tabs; needs <all_urls>
// if(!!browser.tabs.captureVisibleTab && this.props.tab.highlighted) {
// console.log("tabsCapture");
// try {
// image = await browser.tabs.captureVisibleTab( this.props.window.id, {} );
// //console.log(image);
// } catch ( e ) {
// console.log(e.message);
// }
// image = "url(" + image + ")";
// }else{
} }, { key: "resolveFavIconUrl", value: function () {var _ref2 = _asyncToGenerator(regeneratorRuntime.mark(function _callee2() {var image, favIcons, iconUrl, iconName;return regeneratorRuntime.wrap(function _callee2$(_context2) {while (1) {switch (_context2.prev = _context2.next) {case 0:








if (!!this.props.tab.url && this.props.tab.url.indexOf("chrome://") !== 0 && this.props.tab.url.indexOf("about:") !== 0) {











image = this.props.tab.favIconUrl ? "url(" + this.props.tab.favIconUrl + ")" : "";
//}

} else {
favIcons = ["bookmarks", "chrome", "crashes", "downloads", "extensions", "flags", "history", "settings"];
iconName = this.props.tab.url.slice(9).match(/^\w+/g);
iconUrl = this.props.tab.url || "";
iconName = "";
if (iconUrl.length > 9) iconName = iconUrl.slice(9).match(/^\w+/g);
image = !iconName || favIcons.indexOf(iconName[0]) < 0 ? "" : "url(../images/chrome/" + iconName[0] + ".png)";
}
this.setState({
Expand Down
Loading

0 comments on commit 3115819

Please sign in to comment.