|
@@ -33,16 +33,6 @@ $(function(){
|
|
|
// 添加keyWords检查输入框内是否有文字,如果有才能点击添加按钮
|
|
|
$('.addkeyWord input.enterOne').on('input', function() {
|
|
|
var buttonDOM = $(this).siblings()[1].children[0];
|
|
|
- if ($(this).val().length >= 20) {
|
|
|
- var s = $(this).val().slice(0,19);
|
|
|
- $(this).val(s)
|
|
|
-
|
|
|
- weui.toast('关键词不能超过20字', {
|
|
|
- duration: 2000,
|
|
|
- className: 'text-overflow100',
|
|
|
- callback: function(){ console.log('close') }
|
|
|
- });
|
|
|
- }
|
|
|
|
|
|
if ($(this).val().length >= 1) {
|
|
|
buttonDOM.style.opacity = 1;
|
|
@@ -59,20 +49,19 @@ $(function(){
|
|
|
}
|
|
|
});
|
|
|
|
|
|
- // $('.exclusion input.enterOne').on('input', function() {
|
|
|
- // var buttonDOM = $(this).siblings().find('button')[0]
|
|
|
- // if ($(this).val().length >= 1) {
|
|
|
- // buttonDOM.style.opacity = 1
|
|
|
- // buttonDOM.removeAttribute("disabled")
|
|
|
- // } else {
|
|
|
- // buttonDOM.style.opacity = .5
|
|
|
- // buttonDOM.setAttribute("disabled", true)
|
|
|
- // }
|
|
|
- // })
|
|
|
-
|
|
|
// 添加 按钮的点击事件
|
|
|
$('.addkeyWord .btn .save').on('click', function(){
|
|
|
var keyWord = $('.addkeyWord input.enterOne').val();
|
|
|
+ if (keyWord.length >= 20) {
|
|
|
+ var s = keyWord.slice(0,19);
|
|
|
+ $('.addkeyWord input.enterOne').val(s);
|
|
|
+
|
|
|
+ weui.toast('关键词不能超过20字', {
|
|
|
+ duration: 2000,
|
|
|
+ className: 'text-overflow100',
|
|
|
+ callback: function(){ console.log('close') }
|
|
|
+ });
|
|
|
+ }
|
|
|
var keyWordHtml = "";
|
|
|
var html = `
|
|
|
<li>
|
|
@@ -335,25 +324,7 @@ $(function(){
|
|
|
//去空格方法
|
|
|
String.prototype.trim = function(){
|
|
|
return this.replace(/(^\s*)|(\s*$)/g, ' ');
|
|
|
- }
|
|
|
-
|
|
|
- //关键词个数
|
|
|
- $('.modify span').keydown(function(){
|
|
|
- var olength = $(this).text().replace(/\s+/g,'').length;
|
|
|
- // console.log(olength)
|
|
|
- if(olength >= 20){
|
|
|
- $('.fontLength').show();
|
|
|
- var s = $(this).text().slice(0,19)
|
|
|
- $(this).text(s)
|
|
|
- weui.toast('关键词不能超过20字', {
|
|
|
- duration: 2000,
|
|
|
- className: 'text-overflow100',
|
|
|
- callback: function(){
|
|
|
-
|
|
|
- }
|
|
|
- });
|
|
|
- }
|
|
|
- })
|
|
|
+ }
|
|
|
|
|
|
function keepLastIndex(obj) {
|
|
|
if (window.getSelection) {//ie11 10 9 ff safari
|