Last active
August 1, 2017 07:51
-
-
Save Tomyail/2035ce72a5a695e3fb82a6ebf9ebefaa to your computer and use it in GitHub Desktop.
get the selected title and href from redmine and add them to omnifucus
This file contains 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
/** | |
* Created by lixuexin on 2017/8/1. | |
*/ | |
// how to use | |
// 1: selected the items you want to add to omnifocus ( press command for multi select ) | |
// 2: open chrome(>59) console and paste the follow code | |
var count = 0; | |
Array.prototype.forEach.call( | |
document.getElementsByClassName('context-menu-selection'), | |
item => { | |
//roadmap view | |
let text = item | |
.getElementsByClassName('subject')[0] | |
.getElementsByTagName('div')[0]; | |
const href = item | |
.getElementsByClassName('subject')[0] | |
.getElementsByTagName('a')[0].href; | |
// use issues view | |
if (!text) { | |
text = item | |
.getElementsByClassName('subject')[0] | |
.getElementsByTagName('a')[0].innerText; | |
} | |
text = text.replace('#', ''); | |
setTimeout(() => { | |
console.log( | |
encodeURI(`omnifocus:///add?name=${text}¬e=${href}`, '_self') | |
); | |
window.open(encodeURI(`omnifocus:///add?name=${text}¬e=${href}`)); | |
}, count++ * 10); | |
} | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment