diff --git a/module/execution/js/create.js b/module/execution/js/create.js
index 6cd163c3ad..42447b04e2 100644
--- a/module/execution/js/create.js
+++ b/module/execution/js/create.js
@@ -52,15 +52,12 @@ $(function()
{
if(index == 0)
{
- var maxWidth = $('.chosen-container .chosen-drop.chosen-auto-max-width.in').width() - 70;
-
- $('#teams_chosen ul .label').remove();
- $(this).after(' ');
- $(this).attr('style', 'display: inline-block; vertical-align: middle; max-width: ' + maxWidth + 'px');
+ var projectName = subString($(this).text(), 56);
+ $(this).text(projectName);
+ $(this).append(' ');
}
else
{
- $(this).html($(this).html().replace(' ', ''));
$(this).prepend(' ');
}
})
@@ -107,3 +104,23 @@ function refreshPage(projectID)
{
location.href = createLink('execution', 'create', 'projectID=' + projectID);
}
+
+/**
+ * Cut a string of letters and characters with the same length.
+ *
+ * @param string $title
+ * @param int $lengthOfTitle
+ * @access public
+ * @return string
+ */
+function subString(title, lengthOfTitle)
+{
+ if(title.replace(/[\u4e00-\u9fa5]/g, "**").length <= lengthOfTitle) return title;
+
+ var length = 0;
+ for(var i = 0; i < title.length; i ++)
+ {
+ title.charCodeAt(i) > 255 ? length += 2 : length += 1;
+ if(length > lengthOfTitle) return title.substring(0, i) + '...';
+ }
+}