From c80e5180f9474757d1db30edc370906a06754081 Mon Sep 17 00:00:00 2001
From: Last <32554200+InvisibleFuture@users.noreply.github.com>
Date: Thu, 15 Nov 2018 17:35:02 +0800
Subject: [PATCH] Add files via upload
---
z_post/conf.json | 10 ++
z_post/hook/footer_js_after.htm | 159 +++++++++++++++++
z_post/hook/post_list_inc_filelist_after.htm | 41 +++++
z_post/install.php | 46 +++++
z_post/main.js | 171 +++++++++++++++++++
z_post/unstall.php | 16 ++
6 files changed, 443 insertions(+)
create mode 100644 z_post/conf.json
create mode 100644 z_post/hook/footer_js_after.htm
create mode 100644 z_post/hook/post_list_inc_filelist_after.htm
create mode 100644 z_post/install.php
create mode 100644 z_post/main.js
create mode 100644 z_post/unstall.php
diff --git a/z_post/conf.json b/z_post/conf.json
new file mode 100644
index 0000000..01a4aad
--- /dev/null
+++ b/z_post/conf.json
@@ -0,0 +1,10 @@
+{
+ "name": "楼中楼",
+ "brief": "热点讨论,已经是大势所趋",
+ "version": "1.0",
+ "bbs_version": "4.0",
+ "installed": 1,
+ "enable": 0,
+ "hooks_rank": [],
+ "dependencies": []
+}
\ No newline at end of file
diff --git a/z_post/hook/footer_js_after.htm b/z_post/hook/footer_js_after.htm
new file mode 100644
index 0000000..08959cf
--- /dev/null
+++ b/z_post/hook/footer_js_after.htm
@@ -0,0 +1,159 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/z_post/hook/post_list_inc_filelist_after.htm b/z_post/hook/post_list_inc_filelist_after.htm
new file mode 100644
index 0000000..c61e661
--- /dev/null
+++ b/z_post/hook/post_list_inc_filelist_after.htm
@@ -0,0 +1,41 @@
+
+
+
+
+
+$_post['pid']), array('create_date'=>1));
+if($postreply) { foreach($postreply as $_posts) {
+ //创建回复人的信息,每条回复都会被查询一遍似乎很消耗资源
+ $userz = user_read_cache($_posts['uid']);
+ $postz['username'] = array_value($userz, 'username');
+ $postz['user_avatar_url'] = array_value($userz, 'avatar_url');
+ $postz['user'] = $userz ? $userz : user_guest();
+ !isset($postz['floor']) AND $postz['floor'] = '';
+?>
+
+
+ " tabindex="-1">
+
+
+
+ Lv7
+
+
+
+
+
+
diff --git a/z_post/install.php b/z_post/install.php
new file mode 100644
index 0000000..a733c60
--- /dev/null
+++ b/z_post/install.php
@@ -0,0 +1,46 @@
+tablepre;
+
+$sql = "CREATE TABLE IF NOT EXISTS {$tablepre}post_reply (
+ pid int(11) unsigned NOT NULL DEFAULT '0',
+ rid int(11) unsigned NOT NULL AUTO_INCREMENT,
+ uid int(11) unsigned NOT NULL DEFAULT '0',
+ isfirst int(11) unsigned NOT NULL DEFAULT '0',
+ create_date int(11) unsigned NOT NULL DEFAULT '0',
+ userip int(11) unsigned NOT NULL DEFAULT '0',
+ message text NOT NULL DEFAULT '',
+ PRIMARY KEY (pid),
+ KEY (rid)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8";
+$r = db_exec($sql);
+
+/*
+
+
+
+
+目前不使用缓存
+// 缓存 tagid 10000,10000,10000,10000
+$sql = "ALTER TABLE {$tablepre}thread ADD COLUMN tagids char(32) NOT NULL DEFAULT ''";
+$r = db_exec($sql);
+
+// 缓存的时间,用来和 setting('tag_update_time') 对比
+$sql = "ALTER TABLE {$tablepre}thread ADD COLUMN tagids_time int(11) unsigned NOT NULL DEFAULT '0'";
+$r = db_exec($sql);
+
+// tag 缓存的时间
+setting_set('tag_update_time', $time);
+
+
+//$r === FALSE AND message(-1, '创建表结构失败');
+*/
+?>
\ No newline at end of file
diff --git a/z_post/main.js b/z_post/main.js
new file mode 100644
index 0000000..4ee0273
--- /dev/null
+++ b/z_post/main.js
@@ -0,0 +1,171 @@
+/*表情添加*/
+function showEmoji(ele){
+ var the_face=$(ele).closest('.face_top').next()
+ if(the_face.hasClass('emoji_section')){
+ $(ele).removeClass("to_show");
+ the_face.removeClass('emoji_section').find('ul').remove()
+ }else{
+ $(ele).addClass("to_show").siblings().removeClass("to_show")
+ the_face.find('ul').remove()
+ the_face.removeClass('face_section emoji_section').addClass('emoji_section').append(show_emojis())
+ }
+}
+function showFace(ele){
+ var the_face=$(ele).closest('.face_top').next()
+ if(the_face.hasClass('face_section')){
+ $(ele).removeClass("to_show");
+ the_face.removeClass('face_section').find('ul').remove()
+ }else{
+ $(ele).addClass("to_show").siblings().removeClass("to_show")
+ the_face.find('ul').remove()
+ the_face.removeClass('face_section emoji_section').addClass('face_section').append(show_faces())
+ }
+}
+function show_emojis(){
+ var faceList = [" (๑• . •๑) ", " ˋ( ° ▽、° ) ", " (^人^) ", " _(:3」∠)_ ", " →_→ ", " ←_← ", " (*^.^*) ", " ٩(๑`^´๑)۶ ", " ╮(╯_╰)╭ ",
+ " ヾ(′▽`*)ゝ ", " o(≧v≦)o~~ ", " ↖(^ω^)↗ ", " ヽ( ^∀^)ノ ", " ‵(*∩_∩*)′ ", " (/≧▽≦)/~ ", " ㄟ( ▔, ▔ )ㄏ ",
+ " ~( ̄▽ ̄~) ", " (~ ̄▽ ̄)~ ", " /(ㄒoㄒ)/~~ ", " (*/ω\*) ", " ≧▽≦蛤蛤蛤 ", " (°ー°〃) ", " ヾ( ̄▽ ̄) ",
+ " (╯°Д°)╯︵ ", " (☆ω☆) ", " \@_\@ ", " (*´艸`)、 ", " QAQ ", " (⊙o⊙) ", " (×_×)昏倒 ", " ( ˘•㉨•˘ ) ",
+ " ヾ(´(エ)`ノ゙ ", " ฅ( ̳• ◡ • ̳)ฅ ", " ⊙﹏⊙‖∣ ", " (。•ˇ‸ˇ•。) ", " ╭(╯^╰)╮ ", " ( •̀∀•́ ) ", " o(>﹏<)o ",
+ " (ˉ▽ ̄~) 切~~ ", " ⊙ω⊙ ", " =。=b ", " =3333= ", " (ง •̀_•́)ง ", " <(_ _)> ", " o( ̄ヘ ̄o#) ", " ヽ( ̄д ̄;)ノ ",
+ " ヽ(=^・ω・^=)丿 ", " ( ^_^ )/~~拜 ", " Orz ", " ♪(^∇^*) ", " (ฅ´ω`ฅ)留爪 ", " ( ´◔ ‸◔') ", " (*^.^*) ", " p(^_^)q ",
+ " ┗( T﹏T )┛ ", " (ˉ▽ˉ;) ", " Õ_Õ ", " 눈_눈 ", " o(一︿一+)o ", " (〃 ̄︶ ̄)人( ̄︶ ̄〃) "]
+
+ var reply_display_emoji ='';
+ var emoji_li='';
+ var len_emoji=faceList.length;
+ for (var i=0; i"+faceList[i]+ "";
+ }
+ reply_display_emoji ='';
+ return reply_display_emoji
+}
+function addFace(item, imgUlr) {
+ var $write_reply=$(item).closest('.add_icons').parent();
+ var img_str = "";
+ $write_reply.find('.in_write').append(img_str).focus()
+ $write_reply.find('.add_icons').removeClass('face_section').find('ul').remove()
+ $write_reply.find('.face_top li').removeClass()
+ placeCaretAtEnd($write_reply.find('.in_write').get(0));
+}
+function addEmoji(item, str) {
+ var $write_reply=$(item).closest('.add_icons').parent();
+ $write_reply.find('.in_write').append(str).focus()
+ $write_reply.find('.add_icons').removeClass('emoji_section').find('ul').remove()
+ $write_reply.find('.face_top li').removeClass('to_show')
+ placeCaretAtEnd($write_reply.find('.in_write').get(0));
+}
+
+function placeCaretAtEnd(el) {
+ el.focus();
+ if (typeof window.getSelection != "undefined"
+ && typeof document.createRange != "undefined") {
+ var range = document.createRange();
+ range.selectNodeContents(el);
+ range.collapse(false);
+ var sel = window.getSelection();
+ sel.removeAllRanges();
+ sel.addRange(range);
+ } else if (typeof document.body.createTextRange != "undefined") {
+ var textRange = document.body.createTextRange();
+ textRange.moveToElementText(el);
+ textRange.collapse(false);
+ textRange.select();
+ }
+}
+
+//这是增加回复输入框的调用按钮触发
+function showReply(ele){
+ var toReply=null
+ if ($(ele).closest('.more_reply_right').length>0) {
+ toReply="回复 @"+$(ele).closest('.more_reply_right').find('.user_reply_name').html()+":"
+ }else{
+ toReply=''
+ }
+ var replyDiv=""+
+ "
"+
+ "
"+
+ "
"+
+ "- (・ω・)颜文字
"+
+ ""+
+ "
"+
+ "
取消发送
"+
+ "
"+
+ "
"+
+ "
"
+ if ($(ele).parents().find('.write_reply').length>0) {
+ if ($(ele).closest('.user_reply_time').siblings('.write_reply').length>0) {
+ $(ele).parents().find('.write_reply').detach()
+ }else{
+ $(ele).parents().find('.write_reply').detach()
+ $(replyDiv).insertAfter($(ele).closest('.user_reply_time'))
+ }
+ }else{
+ $(replyDiv).insertAfter($(ele).closest('.user_reply_time'))
+
+ placeCaretAtEnd($(ele).closest('.reply_right').find('.in_write').get(0));
+ }
+ $('[contenteditable]').each(function() {
+ // 干掉IE http之类地址自动加链接
+ try {
+ document.execCommand("AutoUrlDetect", false, false);
+ } catch (e) {}
+
+ $(this).on('paste', function(e) {
+ e.preventDefault();
+ var text = null;
+
+ if(window.clipboardData && clipboardData.setData) {
+ // IE
+ text = window.clipboardData.getData('text');
+ } else {
+ text = (e.originalEvent || e).clipboardData.getData('text/plain') || prompt('在这里输入文本');
+ }
+ if (document.body.createTextRange) {
+ if (document.selection) {
+ textRange = document.selection.createRange();
+ } else if (window.getSelection) {
+ sel = window.getSelection();
+ var range = sel.getRangeAt(0);
+
+ // 创建临时元素,使得TextRange可以移动到正确的位置
+ var tempEl = document.createElement("span");
+ tempEl.innerHTML = "FEFF;";
+ range.deleteContents();
+ range.insertNode(tempEl);
+ textRange = document.body.createTextRange();
+ textRange.moveToElementText(tempEl);
+ tempEl.parentNode.removeChild(tempEl);
+ }
+ textRange.text = text;
+ textRange.collapse(false);
+ textRange.select();
+ } else {
+ // Chrome之类浏览器
+ document.execCommand("insertText", false, text);
+ }
+ });
+ // 去除Crtl+b/Ctrl+i/Ctrl+u等快捷键
+ $(this).on('keydown', function(e) {
+ // e.metaKey for mac
+ if (e.ctrlKey || e.metaKey) {
+ switch(e.keyCode){
+ case 66: //ctrl+B or ctrl+b
+ case 98:
+ case 73: //ctrl+I or ctrl+i
+ case 105:
+ case 85: //ctrl+U or ctrl+u
+ case 117: {
+ e.preventDefault();
+ break;
+ }
+ }
+ }
+ });
+});
+}
+function cancelReply(ele){
+ $(ele).closest('.write_reply').detach()
+}
diff --git a/z_post/unstall.php b/z_post/unstall.php
new file mode 100644
index 0000000..caae13d
--- /dev/null
+++ b/z_post/unstall.php
@@ -0,0 +1,16 @@
+tablepre;
+$sql = "DROP TABLE IF EXISTS {$tablepre}post_reply;";
+$r = db_exec($sql);
+
+$r === FALSE AND message(-1, '卸载表失败');
+
+?>
\ No newline at end of file