V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
推荐学习书目
Learn Python the Hard Way
Python Sites
PyPI - Python Package Index
http://diveintopython.org/toc/index.html
Pocoo
值得关注的项目
PyPy
Celery
Jinja2
Read the Docs
gevent
pyenv
virtualenv
Stackless Python
Beautiful Soup
结巴中文分词
Green Unicorn
Sentry
Shovel
Pyflakes
pytest
Python 编程
pep8 Checker
Styles
PEP 8
Google Python Style Guide
Code Style from The Hitchhiker's Guide
python30
V2EX  ›  Python

那位朋友帮我看看这个页面里的 js 代码是怎么实现的?他的实现代码在哪个 js 文件里?

  •  
  •   python30 · 2019-12-20 10:53:06 +08:00 · 3348 次点击
    这是一个创建于 1560 天前的主题,其中的信息可能已经有所发展或是发生改变。
    https://xz.aliyun.com/t/2938

    这个网址里。就有我想要实现的功能。

    就是想针对一位会员回复,点那个: 回复 Ta 后 把该会员的 用户名+@ 加在下面的 editor.md 编辑器里。

    别的不管。只说他的前端 js 代码实现功能。是怎么实现的?
    不知道怎么看她的实现代码? 请指教。谢谢。
    7 条回复    2020-01-07 22:01:00 +08:00
    15651980765
        1
    15651980765  
       2019-12-20 11:12:57 +08:00
    这个随便找个前端应该都没太大问题吧,点击的时候获取下 @的信息,然后添加到编辑框就好了。
    littleylv
        2
    littleylv  
       2019-12-20 11:20:48 +08:00
    <span class="reply-jump reply reply-count " data-nickname="穿山甲">回复 Ta</span>

    学过一天 JS 的都会写吧,简单说就是:
    $('.xx').click(function(){
    $('.xx_textarea').val('@'+$(this).data('nickname'));
    })
    phxsuns
        3
    phxsuns  
       2019-12-20 11:24:08 +08:00
    1、这个功能是前端基本操作,没啥需要参考的。
    2、aliyun 的代码不一定能看的着,有些可能是混淆压缩过的。
    azcvcza
        4
    azcvcza  
       2019-12-20 14:21:30 +08:00
    首先,按下 F12,然后选中编辑区
    其次,在右边的选中 div 或者其他什么元素里,右键,选中 break on -> subtree modification,打上断点
    然后再重复一次操作,这样就可以在线 debug,寻找函数在哪,即使混淆过,但 js 代码混不混淆其实从功能上没多大区别。
    python30
        5
    python30  
    OP
       2019-12-20 16:34:38 +08:00
    多谢各位。已经搞定了。主要是这个编辑器是动态加载。根据大家说的。实现出来了


    function reply() {
    var content = '@' + $(this).attr('data-nickname') + ' ';
    myeditor.insertValue(content);
    myeditor.focus();
    }

    $('.reply-jump').on('click', reply);


    就这两句。不熟前端。。。。真是没办法啊。
    lifespy
        6
    lifespy  
       2019-12-20 16:36:17 +08:00
    我现在试试
    python30
        7
    python30  
    OP
       2020-01-07 22:01:00 +08:00
    @littleylv
    现在发现
    kindeditor 编辑器获得焦点的时候 不自动滚动到编辑器那里。
    还需要手动拖动滚动条下拉到编辑器!

    http://kindeditor.net/ke4/examples/simple.html

    这个是哪里设置不对吗?
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   2037 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 40ms · UTC 16:15 · PVG 00:15 · LAX 09:15 · JFK 12:15
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.