Last active
August 29, 2015 14:07
-
-
Save clemens-tolboom/7e15dac5bfb07a729f6e to your computer and use it in GitHub Desktop.
Auto tag for DrupalCon Amsterdam2014
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
// ==UserScript== | |
// @name www.drupal.org | |
// @namespace tagAmsterdam2014 | |
// @match https://www.drupal.org/node/* | |
// @run-at document-end | |
// @grant none | |
// ==/UserScript== | |
// SAVE as tagAmsterdam2014.user.js | |
// Inspired by https://github.com/webflo/drupalsprint-bookmarklet/blob/gh-pages/index.html | |
// with the help of @helmo | |
if (jQuery('.field-name-field-project').find('.field-item').text() == 'Drupal core') { | |
var tags = jQuery('#edit-taxonomy-vocabulary-9-und').val(); | |
var add_comma = tags.length > 0; | |
tags = jQuery.map(tags.split(', '), jQuery.trim); | |
if (jQuery.inArray('Amsterdam2014', tags) === -1) { | |
if (add_comma) { | |
jQuery('#edit-taxonomy-vocabulary-9-und').val(jQuery('#edit-taxonomy-vocabulary-9-und').val() + ', Amsterdam2014'); | |
} else { | |
jQuery('#edit-taxonomy-vocabulary-9-und').val( 'Amsterdam2014'); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment