Created
February 5, 2013 13:35
-
-
Save liorkesos/4714493 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function similarDate() { | |
var now = new Date(); | |
var sec=now.getSeconds(); | |
if( sec < 10 ) | |
sec='0'+sec; | |
var min=now.getMinutes(); | |
if( min < 10 ) | |
min='0'+min; | |
var hour=now.getHours(); | |
if( hour < 10 ) | |
hour='0'+hour; | |
return now.getDate()+'/'+now.getMonth()+1+'/'+now.getFullYear()+' '+hour+':'+min+':'+sec; | |
} | |
function getOpenTabs( tabs ) { | |
var currDate = similarDate(); | |
chrome.bookmarks.create( { | |
'title': currDate}, | |
function ( newFolder ) { | |
var currentmyfolderID = newFolder.id ; | |
}); | |
alert(currentmyfolderID); | |
for ( var i = 0; i < tabs.length; i++ ) { | |
var tabUrl = tabs[i].url ; | |
var tabTitle = tabs[i].title; | |
/*cosole.log('alert(add to the bookmarks)') ; */ | |
//alert('kk'); | |
chrome.bookmarks.create({'parentId': currentmyfolderID, | |
'title': tabTitle, | |
'url': tabUrl}); | |
} | |
} | |
chrome.browserAction.onClicked.addListener(function(tab) { | |
chrome.tabs.getAllInWindow(null, getOpenTabs); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment