Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@Tomyail
Last active August 1, 2017 07:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Tomyail/2035ce72a5a695e3fb82a6ebf9ebefaa to your computer and use it in GitHub Desktop.
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
/**
* 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}&note=${href}`, '_self')
);
window.open(encodeURI(`omnifocus:///add?name=${text}&note=${href}`));
}, count++ * 10);
}
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment