Created
January 8, 2015 21:36
-
-
Save ebraminio/546e1f896b751add8789 to your computer and use it in GitHub Desktop.
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
var months = 'فروردین اردیبهشت خرداد تیر مرداد شهریور مهر آبان آذر دی بهمن اسفند'.split(' '); | |
var result = []; | |
$("#wpTextbox1").val().replace(/علیهالسلام/g, 'علیهالسلام').split('\n').forEach(function (x) { | |
var p = x.split(' '); | |
result.push('<holiday day="' + p.splice(-1)[0].replace(/[۰-۹]/g, function (x) { return String.fromCharCode(x.charCodeAt(0) - '۰'.charCodeAt(0) + '0'.charCodeAt(0)); }) + '" month="' + (months.indexOf(p.splice(-1)[0]) + 1) + '" year="1394">' + p.join(' ') + '</holiday>'); | |
}); | |
result.join('\n'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment