Conversion to JS plugin