Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- for (i=0; i < existingShortcuts.length; i++) {
- var shortcut = existingShortcuts[i];
- var name = shortcut[0];
- var destination = shortcut[1];
- if (!name || !destination){
- deleteShortcutArray.push(i);
- deletedShortcuts++;
- continue;
- }
- var shortcutList = document.getElementById('shortcut-list');
- var listItem = document.createElement('li');
- var aLink = document.createElement('a');
- aLink.href = destination;
- var idNumber = i - deletedShortcuts;
- var newId = "shortcut" + idNumber ;
- console.log("New id: " + newId);
- aLink.id = newId;
- aLink.draggable = true;
- aLink.ondragstart = function() {
- dragToBin(event)
- }
- aLink.innerHTML = name;
- listItem.appendChild(aLink);
- shortcutList.appendChild(listItem);
- shortcutList.setAttribute('number-shortcuts',i+1-deletedShortcuts);
- }
- //Remove empty shortcuts from array
- for (i=0; i< deleteShortcutArray.length; i++){
- existingShortcuts.splice(deleteShortcutArray[i],1);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement