Skip to content

Instantly share code, notes, and snippets.

@rotty3000
Last active January 20, 2016 07:19
Show Gist options
  • Save rotty3000/5952204 to your computer and use it in GitHub Desktop.
Save rotty3000/5952204 to your computer and use it in GitHub Desktop.
add bookmarks in Liferay via AUI
AUI().use('aui-io', function(A) {
var data = [];
if(confirm('add custom data?')) {
var start = prompt('start index');
var end = prompt('end index');
for (var i = start; i < end; i++) {
data.push('Bookmark' + i);
}
}
var AddBookmark = function(name, callback) {
Liferay.Service(
'/bookmarksentry/add-entry',
{
groupId: themeDisplay.getScopeGroupId(),
folderId: 0,
'name': name,
url: 'http://' + name + '.com',
description: ''
},
callback
);
};
A.each(
data,
function(item, index, collection) {
var then_alert_me = function(response) {
console.log('add ' + item + ' successful...Response: ', response);
};
setTimeout(
function() {
AddBookmark(item, then_alert_me);
},
500
);
}
);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment