I want to write an extension, which can allow users to use their mouses to select multiple tabs in Chrome (the select tabs will be highlighted), just like some multiple-tab handler extensions for Firefox, I have searched but didn't find any useful information, so I am wondering if there is a way to do it, or it's technically possible to build such an extension given Chrome's design?
Thanks!
Currently I'm using Google Chrome v20.0.1132.47 m
I can say this is already possible on that version.
All you need to do is to hold-down the CTRL key on the keyboard and then single-left click on each desired tab to multi-select them.
In addition, once they're selected, you can drag-drop them off the main window to create an independent session with those tabs on the new session. Really useful on dual monitors.
You can use the windows get function to get all of the tabs in a specified window or instead use getAll and iterate through each window then each tab within each of those windows. You must specify the option populate:true to get the tabs array to return populated. The property highlighted should tell you if that tab is highlighted.
chrome.windows.get(integer windowId, {populate:true}, function (window) {
var highlightedTabs = new Array();
for(var index in window.tabs)
if(window.tabs[index].highlighted)
highlightedTabs.push(windows.tabs[index]);
// your code here
});
For a full reference to the format of the tab object see below:
http://code.google.com/chrome/extensions/tabs.html#types
Related
I am using protractor with Jasmine framework for automating angular5 application. My developers have used API/created google maps dropdown as mentioned in the link
https://developers.google.com/maps/documentation/javascript/examples/places-autocomplete
When user types on the address, google maps API is invoked and lists the places related to search, this will not populate/change any tags of developer tools HTML. So basically when user types address then it will populate the address dropdown and I want to select any address either through mouse/keyboard arrow key. When I am automating, I could reach till passing string to the address web element later it errors saying
No details available for input:'Mumbai'
with the popup displayed on the window. Any help is greatly appreciated.
I tried below code,
browser.actions().mouseMove(element(by.id('fromAddress-input')).sendKeys("Mumbai")).perform();
browser.actions().sendKeys(protractor.Key.ENTER).perform();
browser.actions().sendKeys(protractor.Key.ARROW_DOWN).perform();
browser.actions().sendKeys(protractor.Key.ENTER).perform();
First you need to switch to the Iframe that contains the elements you want, use this to change to the Iframe:
var driver = browser.driver;
var loc = by.tagName('iframe');
var el = driver.findElement(loc);
browser.switchTo().frame(el);
Create a function with this code and place after you load the page.
Then your code will work but remove the first enter, do this for example:
browser.actions().mouseMove(element(by.id('fromAddress-input')).sendKeys("Mumbai")).perform();
browser.actions().sendKeys(protractor.Key.ARROW_DOWN).perform();
browser.actions().sendKeys(protractor.Key.ENTER).perform();
change back to the main frame using this:
browser.switchTo().defaultContent();
I'm trying to find a way to change order of sitecore custom / editor tabs. by default sitecore displays custom tabs, content tab and dynamic tabs, and according to
https://www.markstiles.net/Blog/2011/02/27/editor-tabs-in-sitecore.aspx
the only way to change order of tabs is to dig into sitecore. sitecore forum isn't helpful either. any ideas if this is configurable in sitecore? above mentioned post is pretty old and sth might have changed since then, but I haven't found any info about it.
As of Sitecore 8.0 update 3, the sitecore code for retrieving the tabs is still the same with the addition of the buckets tab:
Retrieved from Sitecore.Client.dll in the Sitecore.Shell.Applications.ContentManager.Editor class
private static List<Editor.EditorTab> GetEditorTabs(Item item, Editor.Sections sections)
{
Assert.ArgumentNotNull(item, "item");
Assert.ArgumentNotNull(sections, "sections");
List<Editor.EditorTab> editorTabs = new List<Editor.EditorTab>();
Editor.GetCustomEditorTab(item, editorTabs);
Editor.GetCustomEditorTabs(item, editorTabs);
Editor.GetContentTab(item, sections, editorTabs);
if (InternalSettings.ItemBucketsEnabled)
{
Editor.GetNewSearchTab(item, sections, editorTabs);
}
Editor.GetDynamicTabs(item, editorTabs);
return editorTabs;
}
So unfortunately, it looks like this is still the order by which they get rendered. As the article mentions, this could potentially be overridden, but likely to be quite involved.
I've achieved this slightly different. Not 100% satisfied with the solution, but it works until there is a better option.
In my custom tab, that displays as the first tab and therefore the active tab when I select an item. I have added the following JavaScript code to change the active tab back to the standard Sitecore Tab.
parent.scContent.onEditorTabClick(this, null, "Content");
The code goes up to the parent window as the Tab is an iFrame and set the active tab to the "Content" tab.
My custom tab is a SPEAK tab running on Sitecore 8. Here is the SPEAK javascript PageCode for reference.
https://github.com/sobek1985/SitecoreContentEditorTabs/blob/Complete/SitecoreContentEditorTabs/SitecoreContentEditorTabs.js
And a blog post i wrote on the subject too: http://mikerobbins.co.uk/2015/07/14/sitecore-content-editor-tabs-in-speak/
Ive had a request from a client to make a popup box appear on the click of a databar within an SSRS report. Not had any luck with various Google Searches and just wanted to know if anybody has either got this work directly or has any suggestions for a workaround they have used?
Bit of background on the actual report itself, it simply contains a table with various stacked DataBars showing comparable data between multiple users in a system. The ability is needed to click a bar and see which User that bar relates to.
Any suggestions are appreciated.
It's not quite the same thing, but you can use the SSRS tooltips functionality to achieve something similar, i.e. a user will hover over a part of a chart and some contextual text information will be displayed.
Show ToolTips on a Series has some further information.
You can add an action to an object with a javascript popup which can show a specific URL or another report. In the action click on Fx to set an expression as follows:
I used a different script to popup a URL which contains an image url from the database:
="javascript:void(window.open('" + Fields!ImageURL.Value + "', null, 'width=800, height=500, status=no, toolbar=no, menubar=no, location=no'))"
( you can replace Fields!Image.Value with a url , this is the URL from a database field)
a
On a PC this will showup properly sized as a popup. On an iPad it will appear as a new tab.
Please give me an advice on chrome extension API. I'm trying to write a code that would do the same thing like when I highlight all the tabs in chrome, click the right button on them and choose reload, so all the tabs get reloaded together at once. I have no problems with highlighting the tabs, but how can I apply some operation to those highlighted tabs ?
Applying operations on a set of tabs requires passing the tab ID(s) to the respective methods in the chrome.tabs API.
So, in your case, simply remember the tab IDs of the tabs you highlighted programmatically (or use chrome.tabs.query to fetch them) and call chrome.tabs.reload sequentially, passing a single tab ID per invocation. (Unfortunately, the API does not accept an array of IDs, so you'll have to pass them one by one.)
In a chrome extension, I've created tab properties that I'm trying to store with each tab. What is the best way to do this? I've looked into using localStorage, but it seems like there could be an easier way. The data is by no means permanent, it only exists as long as the tab does.
There's definitely no need to use localStorage. Without the notion "data is by no means permanent", one already knows that: tab IDs are unique within a session. From this fact, it follows that the data is non-persistent.
The best method to implement it is to maintain a hash of tab properties:
chrome.tabs.onCreated (optional, add initial info to tab hash)
chrome.tabs.onUpdated - (Add/) Update tab hash (URL is available)
chrome.tabs.onRemoved - Remove hash entry
Tab objects are not expensive: All properties are primitives (booleans, numbers, strings).
For instance (background page only):
var tabStore = {}; // <-- Collection of tabs
chrome.tabs.onUpdated.addListener(function(tabId, changeInfo, tab) {
tabStore[tabId] = tab;
});
chrome.tabs.onRemoved.addListener(function(tabId) {
delete tabStore[tabId];
});
IMPORTANT ADDENDUM to Rob W's answer.
Make sure to also listen to tabs.onReplaced as well, and update the tabStore accordingly.
chrome.tabs.onReplaced.addListener(function(addedTabId, removedTabId) {
tabStore[addedTabId] = tabStore[removedTabId];
delete tabStore[removedTabId];
});
Chrome can change the id of a tab under the hood without warning or signs. As far as I know, the only place that this happens is the Google "instant search" when you type in a search into the address bar. It may be an edge case, but if you don't track this, it could end up being a very insidious problem.