<?php
$hashtag = '';
$url = '';
if (isset($_GET['link1']) && $_GET['link1'] == 'hashtag' && !empty($_GET['hash'])) {
  $hashtag = '#' . $_GET['hash'];
}
if (!empty($_GET['url'])) {
  $url = urldecode($_REQUEST['url']);
}
?>
<form action="#" method="post" class="post publisher-box" id="publisher-box-focus">
	<div class="panel panel-white post panel-shadow">
		<div id="post-textarea" onclick="Wo_ShowPosInfo();">
			<div class="wo_pub_txtara_combo">
				<?php if ($wo['page'] != 'events') { ?>
				<img class="post-avatar" src="<?php echo (empty($wo['page_profile']['avatar'])) ? $wo['user']['avatar'] : $wo['page_profile']['avatar'];?>">
				<?php } ?>
				<i class="fa fa-spinner fa-spin" id="loading_indicator"></i>
				<textarea onkeyup="textAreaAdjust(this, 70)" name="postText" class="form-control postText" cols="10" placeholder="<?php echo $wo['lang']['publisher_box_placeholder']; ?>" dir="auto"><?php echo $hashtag;?><?php echo $url; ?></textarea>
			
				<!--Add Emojis-->
				<div class="dropdown add-emoticons">
					<a href="#" class="dropdown-toggle" type="button" id="dropdownEmo" data-toggle="dropdown" aria-haspopup="true" aria-expanded="true">
						<svg xmlns="http://www.w3.org/2000/svg" version="1.1" width="24" height="24" viewBox="0 0 24 24" class="feather feather-emoticons"><path d="M5.5,2C3.56,2 2,3.56 2,5.5V18.5C2,20.44 3.56,22 5.5,22H16L22,16V5.5C22,3.56 20.44,2 18.5,2H5.5M5.75,4H18.25A1.75,1.75 0 0,1 20,5.75V15H18.5C16.56,15 15,16.56 15,18.5V20H5.75A1.75,1.75 0 0,1 4,18.25V5.75A1.75,1.75 0 0,1 5.75,4M14.44,6.77C14.28,6.77 14.12,6.79 13.97,6.83C13.03,7.09 12.5,8.05 12.74,9C12.79,9.15 12.86,9.3 12.95,9.44L16.18,8.56C16.18,8.39 16.16,8.22 16.12,8.05C15.91,7.3 15.22,6.77 14.44,6.77M8.17,8.5C8,8.5 7.85,8.5 7.7,8.55C6.77,8.81 6.22,9.77 6.47,10.7C6.5,10.86 6.59,11 6.68,11.16L9.91,10.28C9.91,10.11 9.89,9.94 9.85,9.78C9.64,9 8.95,8.5 8.17,8.5M16.72,11.26L7.59,13.77C8.91,15.3 11,15.94 12.95,15.41C14.9,14.87 16.36,13.25 16.72,11.26Z" /></svg>
					</a>
					<ul class="dropdown-menu dropdown-menu-right" aria-labelledby="dropdownEmo">
						<?php  
						foreach ($wo['emo'] as $code => $name) {
						$code   = $code;
						echo  '<span onclick="Wo_AddEmo(\'' . $code . '\',\'#post-textarea textarea\'), Wo_ShowPosInfo();"><i class="pointer twa-lg twa twa-' . $name . '"></i></span>';
						} ?>
					</ul>
				</div>
			
				<!--Add Image-->
				<div class="poster-left-buttons camera-button" onclick="Wo_ShowPosInfo();">
					<div class="input-group">
						<span class="btn btn-default btn-file" id="camera-button-btn" onclick="document.getElementById('publisher-photos').click(); return false">
							<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-camera" color="#5b5b5b"><path d="M23 19a2 2 0 0 1-2 2H3a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h4l2-3h6l2 3h4a2 2 0 0 1 2 2z"></path><circle cx="12" cy="13" r="4"></circle></svg>
						</span>
					</div>
				</div>
			</div>
		</div>
		
		<!--Uploaded Video-->
		<?php if ($wo['config']['video_upload'] == 1) { ?>
		<div class="publisher-hidden-option" id="video-form">
			<div class="inner-addon <?php echo Wo_RightToLeft('left-addon');?>">
				<span class="pull-left">
					<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-video"><polygon points="23 7 16 12 23 17 23 7"></polygon><rect x="1" y="5" width="15" height="14" rx="2" ry="2"></rect></svg>
					<input name="videocount" type="text" class="form-control bg_read_input" readonly>
				</span>
				<span class="pull-right pointer video-custom-thumb">
					<?php echo $wo['lang']['custom_thumbnail']; ?>&nbsp;<i class="fa fa-caret-down"></i>
				</span>
			</div>
			<div class="video-poster-image">
				<div class="thumb-renderer pointer" onclick="$('#custom-video-thumb').trigger('click');">
					<div id="post_vthumb_droparea">
						<div class="preview">
							<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-upload-cloud" color="#384047"><polyline points="16 16 12 12 8 16"></polyline><line x1="12" y1="12" x2="12" y2="21"></line><path d="M20.39 18.39A5 5 0 0 0 18 9h-1.26A8 8 0 1 0 3 16.3"></path><polyline points="16 16 12 12 8 16"></polyline></svg>
							<div class="error-text-renderer"></div>
							<div>
								<p><?php echo $wo['lang']['drop_img_here']; ?> <?php echo $wo['lang']['or']; ?> <?php echo $wo['lang']['browse_to_upload']; ?></p>
							</div>
						</div>
						<div class="image"></div>
					</div>
				</div>
			</div>
			<input type="file" class="hidden" name="video_thumb" id="custom-video-thumb" accept="image/*">
		</div>
		<?php } ?>
		
		<!--Uploaded Audio-->
		<?php if ($wo['config']['audio_upload'] == 1) { ?>
		<div class="publisher-hidden-option" id="music-form">
			<div class="inner-addon <?php echo Wo_RightToLeft('left-addon');?>">
				<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-music"><path d="M9 17H5a2 2 0 0 0-2 2 2 2 0 0 0 2 2h2a2 2 0 0 0 2-2zm12-2h-4a2 2 0 0 0-2 2 2 2 0 0 0 2 2h2a2 2 0 0 0 2-2z"></path><polyline points="9 17 9 5 21 3 21 15"></polyline></svg>
				<input name="musiccount" type="text" class="form-control bg_read_input" readonly>
			</div>
		</div>
		<?php } ?>
		
		<!--Poll Options-->
		<div id="poll-form">
			<div class="publisher-hidden-option answers">
				<input name="answer[]" type="text" class="form-control" placeholder="<?php echo $wo['lang']['answer'] ?> 1">
				<input name="answer[]" type="text" class="form-control" placeholder="<?php echo $wo['lang']['answer'] ?> 2">
			</div>
			<div class="create-poll" onclick="Wo_AddAnswer();" id="add_answer">
				<div class="create-text"><?php echo $wo['lang']['add_answer'] ?></div>
			</div>
		</div>
		
		<!--Create Album-->
		<div style="position:relative;">
			<div id="album-form">
				<div class="publisher-hidden-option">
					<input name="album_name" type="text" class="form-control" placeholder="<?php echo $wo['lang']['album_name'];?>">
				</div>
			</div>
			<div class="publisher-hidden-option" id="photo-form">
				<div class="inner-addon <?php echo Wo_RightToLeft('left-addon');?>">
					<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-image"><rect x="3" y="3" width="18" height="18" rx="2" ry="2"></rect><circle cx="8.5" cy="8.5" r="1.5"></circle><polyline points="21 15 16 10 5 21"></polyline></svg>
					<input name="phtoscount" type="text" class="form-control bg_read_input" readonly>
				</div>
				<div class="create-album <?php echo Wo_RightToLeft('pull-right');?>" onclick="Wo_OpenAlbum();">
					<div class="create-text"><?php echo $wo['lang']['create_album'];?></div>
				</div>
				<div class="clear"></div>
				<div style="overflow-x: auto;"><div id="image-holder"></div></div>
			</div>
		</div>
		
		<!--Uploaded File-->
		<div class="publisher-hidden-option" id="file-form">
			<div class="inner-addon <?php echo Wo_RightToLeft('left-addon');?>">
				<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-file"><path d="M13 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V9z"></path><polyline points="13 2 13 9 20 9"></polyline></svg>
				<input name="filename" type="text" class="form-control bg_read_input" readonly>
			</div>
		</div>
		
		<!--Set Location-->
		<div class="publisher-hidden-option" id="map-form">
			<div class="inner-addon <?php echo Wo_RightToLeft('left-addon');?>">
				<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-map-pin"><path d="M21 10c0 7-9 13-9 13s-9-6-9-13a9 9 0 0 1 18 0z"></path><circle cx="12" cy="10" r="3"></circle></svg>
				<input name="postMap" id="searchTextField" type="text" class="form-control" placeholder="<?php echo $wo['lang']['maps_placeholder']?>">
			</div>
		</div>
		
		<!--Add Emojis-->
		<div id="emo-form">
			<div class="publisher-hidden-option" style="border-top: 1px dashed #ededed;">
				<div class="feelings-type-to <?php echo Wo_RightToLeft('pull-left');?> pointer" onclick="Wo_RestFeelings();"></div>
				<span class="feelings-value"></span>
				<input name="feeling" id="feelings-text" type="text" class="form-control bg_read_input" placeholder="<?php echo html_entity_decode($wo["lang"]["feel_d"])?>" onclick="Wo_ShowFeelings();" autocomplete="no">
				<input name="feeling_type" type="hidden" id="feeling-type" value="">
				<div class="clear"></div>
			</div>
			<div class="feeling-type feeling-types">
				<ul>
					<li class="pointer" onclick='Wo_ShowFeelingType("feelings", "<?php echo $wo['lang']['feeling'];?>", "<?php echo $wo['lang']['feeling_q'];?>");'>
						<svg fill="#009da0" height="24" viewBox="0 0 24 24" width="24" xmlns="http://www.w3.org/2000/svg" class="feather feather-user-plus"><path d="M0 0h24v24H0z" fill="none"></path><path d="M11.99 2C6.47 2 2 6.48 2 12s4.47 10 9.99 10C17.52 22 22 17.52 22 12S17.52 2 11.99 2zM12 20c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8zm3.5-9c.83 0 1.5-.67 1.5-1.5S16.33 8 15.5 8 14 8.67 14 9.5s.67 1.5 1.5 1.5zm-7 0c.83 0 1.5-.67 1.5-1.5S9.33 8 8.5 8 7 8.67 7 9.5 7.67 11 8.5 11zm3.5 6.5c2.33 0 4.31-1.46 5.11-3.5H6.89c.8 2.04 2.78 3.5 5.11 3.5z"></path></svg> <span><?php echo $wo['lang']['feeling'];?></span>
					</li>
					<li class="pointer" onclick='Wo_ShowFeelingType("traveling", "<?php echo $wo['lang']['traveling'];?>" , "<?php echo $wo['lang']['traveling_q'];?>");'>
						<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-briefcase" color="#3F51B5"><rect x="2" y="7" width="20" height="14" rx="2" ry="2"></rect><path d="M16 21V5a2 2 0 0 0-2-2h-4a2 2 0 0 0-2 2v16"></path></svg> <span><?php echo $wo['lang']['traveling'];?></span>
					</li>
					<li class="pointer" onclick='Wo_ShowFeelingType("watching", "<?php echo $wo['lang']['watching'];?>", "<?php echo $wo['lang']['watching_q'];?>");'>
						<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-tv" color="#E91E63"><rect x="2" y="7" width="20" height="15" rx="2" ry="2"></rect><polyline points="17 2 12 7 7 2"></polyline></svg> <span><?php echo $wo['lang']['watching'];?></span>
					</li>
					<li class="pointer" onclick='Wo_ShowFeelingType("playing", "<?php echo $wo['lang']['playing'];?>", "<?php echo $wo['lang']['playing_q'];?>");'>
						<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-target" color="#FF9800"><circle cx="12" cy="12" r="10"></circle><circle cx="12" cy="12" r="6"></circle><circle cx="12" cy="12" r="2"></circle></svg> <span><?php echo $wo['lang']['playing'];?></span>
					</li>
					<li class="pointer" onclick='Wo_ShowFeelingType("listening", "<?php echo addslashes($wo['lang']['listening']);?>", "<?php echo addslashes($wo['lang']['listening_q']);?>");'>
						<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-headphones" color="#03A9F4"><path d="M3 18v-6a9 9 0 0 1 18 0v6"></path><path d="M21 19a2 2 0 0 1-2 2h-1a2 2 0 0 1-2-2v-3a2 2 0 0 1 2-2h3zM3 19a2 2 0 0 0 2 2h1a2 2 0 0 0 2-2v-3a2 2 0 0 0-2-2H3z"></path></svg> <span><?php echo $wo['lang']['listening'];?></span>
					</li>
				</ul>
			</div>
			<div class="feeling-type feelings">
				<ul>
					<?php foreach ($wo['feelingIcons'] as $icon_name => $icon_code) { ?>
					<li class="pointer" onclick="Wo_AddFeeling('<?php echo $icon_name;?>', '<?php echo $wo['lang'][$icon_name]; ?>', '<?php echo $icon_code;?>');"><i class="twa-lg twa twa-<?php echo $icon_code; ?>"></i> <?php echo $wo['lang'][$icon_name]; ?></li>
					<?php } ?>
				</ul>
			</div>
		</div>
		
		<!--Add Stickers-->
		<?php if ($wo['config']['stickers'] == 1): ?>
		<div id="gif-form">
			<div class="w100" id="publisher-box-stickers">
				<input type="text" class="form-control" style="border: none;" placeholder="<?php echo $wo['lang']['search'] ?> GIFs" onkeyup="Wo_GetPostStickers(this.value)">
				<div class="ball-pulse <?php echo Wo_RightToLeft('pull-right');?>" style="margin: -33px 10px 0px 0px;"><div></div><div></div><div></div></div>
				<div id="publisher-box-stickers-cont"></div>
			</div>
		</div>
		<?php endif ?>

		<div id="results"></div>
		
		<!--Progress Bar-->
		<div class="publisher-hidden-option">
			<div id="progress">
				<span id="percent" class="<?php echo Wo_RightToLeft('pull-right');?>">0%</span>
				<div class="progress">
					<div id="bar" class="progress-bar active"></div> 
				</div>
				<div class="clear"></div>
			</div>
		</div>
		
		<!--Publisher Box Footer-->
		<div class="publisher-box-footer">
		<div class="row pub-footer-upper">
			<!--Add Post Color-->
			<?php if ($wo['config']['colored_posts_system'] == 1 && !empty($wo['post_colors'])) { ?>
			<div class="all_colors">
				<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" onclick="Wo_CloseColor()"><path fill="currentColor" d="M19,6.41L17.59,5L12,10.59L6.41,5L5,6.41L10.59,12L5,17.59L6.41,19L12,13.41L17.59,19L19,17.59L13.41,12L19,6.41Z" /></svg>
				<div>
				<?php foreach ($wo['post_colors'] as $key => $color) {
					if (!empty($color->color_1) && !empty($color->color_2) && !empty($color->text_color)) { ?>
						<div class="pointer all_colors_display" onclick="Wo_ChangeColor('<?php echo $color->color_1; ?>','<?php echo $color->color_2; ?>','<?php echo $color->text_color; ?>','',<?php echo $color->id; ?>)"> 
							<div class="all_colors_style" style="background-image: linear-gradient(45deg, <?php echo $color->color_1; ?> 0%, <?php echo $color->color_2; ?> 100%);"></div>
						</div>
				<?php }elseif (!empty($color->image) && !empty($color->text_color)) { ?>
					<div class="pointer all_colors_display" onclick="Wo_ChangeColor('','','<?php echo $color->text_color; ?>','<?php echo Wo_GetMedia($color->image); ?>',<?php echo $color->id; ?>)"> 
						<div class="all_colors_style_image" style="background-image:url('<?php echo Wo_GetMedia($color->image); ?>');"></div>
					</div>
				<?php } ?>
				<?php } ?>
				</div>
				<input type="hidden" name="post_color" id="post_color_input">
			</div>
			<?php } ?>
			
			<!--Uploaded Image-->
			<div class="<?php echo Wo_RightToLeft('pull-left');?>">
				<div class="poster-left-buttons">
					<div class="input-group">
						<span class="btn btn-file">
							<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path fill="#4db3f6" d="M8.5,13.5L11,16.5L14.5,12L19,18H5M21,19V5C21,3.89 20.1,3 19,3H5A2,2 0 0,0 3,5V19A2,2 0 0,0 5,21H19A2,2 0 0,0 21,19Z" /></svg>
							<input type="file" id="publisher-photos" accept="image/x-png, image/gif, image/jpeg" name="postPhotos[]" multiple="multiple">
						</span>
					</div>
				</div>
			</div>

			<!--Uploaded Video-->
			<?php if ($wo['config']['video_upload'] == 1) { ?>
			<div class="<?php echo Wo_RightToLeft('pull-left');?>">
				<div class="poster-left-buttons">
					<div class="input-group">
						<span class="btn btn-file">
							<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 512 512"><path fill="#71a257" d="M450.6 153.6c-3.3 0-6.5.9-9.3 2.7l-86.5 54.6c-2.5 1.6-4 4.3-4 7.2v76c0 2.9 1.5 5.6 4 7.2l86.5 54.6c2.8 1.7 6 2.7 9.3 2.7h20.8c4.8 0 8.6-3.8 8.6-8.5v-188c0-4.7-3.9-8.5-8.6-8.5h-20.8zM273.5 384h-190C55.2 384 32 360.8 32 332.6V179.4c0-28.3 23.2-51.4 51.4-51.4h190c28.3 0 51.4 23.2 51.4 51.4v153.1c.1 28.3-23 51.5-51.3 51.5z"/></svg>
							<input type="file" id="publisher-video" name="postVideo" accept="video/*">
						</span>
					</div>
				</div>
			</div>
			<?php } ?>
			
			<!--Add GIFs-->
			<?php if ($wo['config']['stickers'] == 1): ?>
			<div class="<?php echo Wo_RightToLeft('pull-left');?> gif-form" >
				<div class="poster-left-buttons">
					<div class="input-group">
						<span class="btn btn-file btngif" style="padding: 0px;">
							<svg fill="#9d87d2" height="34" viewBox="0 0 24 24" width="34" xmlns="http://www.w3.org/2000/svg"><path d="M0 0h24v24H0z" fill="none"></path><defs> <path d="M24 24H0V0h24v24z" id="a"/> </defs> <clipPath id="b"> <use overflow="visible" xlink:href="#a"/> </clipPath> <path clip-path="url(#b)" d="M11.5 9H13v6h-1.5zM9 9H6c-.6 0-1 .5-1 1v4c0 .5.4 1 1 1h3c.6 0 1-.5 1-1v-2H8.5v1.5h-2v-3H10V10c0-.5-.4-1-1-1zm10 1.5V9h-4.5v6H16v-2h2v-1.5h-2v-1z"/></svg>
						</span>
					</div>
				</div>
			</div>
			<?php endif ?>
			
			<!--Record Audio-->
			<?php if ($wo['config']['audio_upload'] == 1) { ?>
			<div class="<?php echo Wo_RightToLeft('pull-left');?>" id="recordPostAudioWrapper">
				<div class="poster-left-buttons">
					<div class="input-group">
						<span  class="btn btn-file" id="recordPostAudio" data-record="0">
							<svg xmlns="http://www.w3.org/2000/svg" width="23" height="23" viewBox="0 0 24 24"><path fill="#ff3a55" d="M12,2A3,3 0 0,1 15,5V11A3,3 0 0,1 12,14A3,3 0 0,1 9,11V5A3,3 0 0,1 12,2M19,11C19,14.53 16.39,17.44 13,17.93V21H11V17.93C7.61,17.44 5,14.53 5,11H7A5,5 0 0,0 12,16A5,5 0 0,0 17,11H19Z" /></svg>
						</span>
						<span id="postRecordingTime" class="hidden">00:00</span>
					</div>
				</div>
			</div>
			<?php } ?>
         
			<!--Add Feeling-->
			<div class="<?php echo Wo_RightToLeft('pull-left');?> emo-form" >
				<div class="poster-left-buttons">
					<div class="input-group">
						<span class="btn btn-file">
							<svg xmlns="http://www.w3.org/2000/svg" width="23" height="23" viewBox="0 0 24 24"><path fill="#f3c038" d="M12,2C6.486,2,2,6.486,2,12s4.486,10,10,10c5.514,0,10-4.486,10-10S17.514,2,12,2z M8.5,8C9.328,8,10,8.896,10,10	s-0.672,2-1.5,2S7,11.104,7,10S7.672,8,8.5,8z M12,18c-1.905,0-3.654-0.874-4.8-2.399l1.599-1.201C9.563,15.417,10.73,16,12,16	c1.27,0,2.436-0.583,3.2-1.601l1.6,1.201C15.653,17.126,13.904,18,12,18z M15.5,12c-0.828,0-1.5-0.896-1.5-2s0.672-2,1.5-2	S17,8.896,17,10S16.328,12,15.5,12z" /></svg>
						</span>
					</div>
				</div>
			</div>
			
			<!--Uploaded File-->
			<?php if($wo['config']['fileSharing'] == 1) { ?>
			<div class="<?php echo Wo_RightToLeft('pull-left');?>">
				<div class="poster-left-buttons">
					<div class="input-group">
						<span class="btn btn-file">
							<svg xmlns="http://www.w3.org/2000/svg" width="25" height="25" viewBox="0 0 512 512"><path fill="#6bcfef" d="M312 155h91c2.8 0 5-2.2 5-5 0-8.9-3.9-17.3-10.7-22.9L321 63.5c-5.8-4.8-13-7.4-20.6-7.4-4.1 0-7.4 3.3-7.4 7.4V136c0 10.5 8.5 19 19 19z"/><path fill="#6bcfef" d="M267 136V56H136c-17.6 0-32 14.4-32 32v336c0 17.6 14.4 32 32 32h240c17.6 0 32-14.4 32-32V181h-96c-24.8 0-45-20.2-45-45z"/></svg>
							<input type="file" id="publisher-file" name="postFile">
						</span>
					</div>
				</div>
			</div>
			<?php } ?>
		 
			<!--Create Product-->
			<?php if (($wo['page'] == 'home' || $wo['page'] == 'timeline') && $wo['config']['classified'] == 1) { ?>
			<div class="<?php echo Wo_RightToLeft('pull-left');?>">
				<div class="poster-left-buttons">
					<div class="input-group">
						<a href="#" data-toggle="modal" data-target="#create-product-modal" data-backdrop="static" data-keyboard="false" class="btn btn-file">
							<svg xmlns="http://www.w3.org/2000/svg" width="22" height="22" viewBox="0 0 24 24"><path fill="#f07729" d="M3.572,5.572l4.506,10.813C8.233,16.757,8.597,17,9.001,17H18c0.417,0,0.79-0.259,0.937-0.648l3-8 c0.115-0.308,0.072-0.651-0.114-0.921C21.635,7.161,21.328,7,21,7H6.333L4.923,3.615C4.768,3.243,4.404,3,4,3H2v2h1L3.572,5.572z"/><circle fill="#f07729" cx="10.5" cy="20.5" r="1.5"/><circle fill="#f07729" cx="16.438" cy="20.5" r="1.5"/></svg>
						</a>
					</div>
				</div>
			</div>
			<?php } ?>
		 
			<!--Create Poll-->
			<div class="<?php echo Wo_RightToLeft('pull-left');?>">
				<div class="poster-left-buttons">
					<div class="input-group">
						<span class="btn btn-file poll-form">
							<svg xmlns="http://www.w3.org/2000/svg" width="26" height="26" viewBox="0 0 24 24"><path fill="#31a38c" d="M17,17H15V13H17M13,17H11V7H13M9,17H7V10H9M19,3H5C3.89,3 3,3.89 3,5V19A2,2 0 0,0 5,21H19A2,2 0 0,0 21,19V5C21,3.89 20.1,3 19,3Z" /></svg>
						</span>
					</div>
				</div>
			</div>
		 
			<!--Add Location-->
			<div class="<?php echo Wo_RightToLeft('pull-left');?>">
				<div class="poster-left-buttons">
					<div class="input-group">
						<span class="btn btn-file map-form">
							<svg xmlns="http://www.w3.org/2000/svg" width="23" height="23" viewBox="0 0 24 24"><path fill="#f35369" d="M12,11.5A2.5,2.5 0 0,1 9.5,9A2.5,2.5 0 0,1 12,6.5A2.5,2.5 0 0,1 14.5,9A2.5,2.5 0 0,1 12,11.5M12,2A7,7 0 0,0 5,9C5,14.25 12,22 12,22C12,22 19,14.25 19,9A7,7 0 0,0 12,2Z" /></svg>
						</span>
					</div>
				</div>
			</div>
		 
			<!--Uploaded Music-->
			<?php if ($wo['config']['audio_upload'] == 1) { ?>
			<div class="<?php echo Wo_RightToLeft('pull-left');?>">
				<div class="poster-left-buttons">
					<div class="input-group">
						<span class="btn btn-file">
							<svg xmlns="http://www.w3.org/2000/svg" width="26" height="26" viewBox="0 0 24 24"><path fill="#4db3f6" d="M16,9V7H12V12.5C11.58,12.19 11.07,12 10.5,12A2.5,2.5 0 0,0 8,14.5A2.5,2.5 0 0,0 10.5,17A2.5,2.5 0 0,0 13,14.5V9H16M12,2A10,10 0 0,1 22,12A10,10 0 0,1 12,22A10,10 0 0,1 2,12A10,10 0 0,1 12,2Z" /></svg>
							<input type="file" id="publisher-music" name="postMusic" accept="audio/*">
						</span>
					</div>
				</div>
			</div>
			<?php } ?>
			
			<!--Add Bg Color-->
			<?php if ($wo['config']['colored_posts_system'] == 1 && !empty($wo['post_colors'])) { ?>
			<div class="<?php echo Wo_RightToLeft('pull-left');?>">
				<div class="poster-left-buttons" onclick="Wo_ShowColors()">
					<div class="input-group">
						<span class="btn btn-file">
							<svg xmlns="http://www.w3.org/2000/svg" width="25" height="25" viewBox="0 0 24 24"><path fill="#673ab7" d="M17.5,12A1.5,1.5 0 0,1 16,10.5A1.5,1.5 0 0,1 17.5,9A1.5,1.5 0 0,1 19,10.5A1.5,1.5 0 0,1 17.5,12M14.5,8A1.5,1.5 0 0,1 13,6.5A1.5,1.5 0 0,1 14.5,5A1.5,1.5 0 0,1 16,6.5A1.5,1.5 0 0,1 14.5,8M9.5,8A1.5,1.5 0 0,1 8,6.5A1.5,1.5 0 0,1 9.5,5A1.5,1.5 0 0,1 11,6.5A1.5,1.5 0 0,1 9.5,8M6.5,12A1.5,1.5 0 0,1 5,10.5A1.5,1.5 0 0,1 6.5,9A1.5,1.5 0 0,1 8,10.5A1.5,1.5 0 0,1 6.5,12M12,3A9,9 0 0,0 3,12A9,9 0 0,0 12,21A1.5,1.5 0 0,0 13.5,19.5C13.5,19.11 13.35,18.76 13.11,18.5C12.88,18.23 12.73,17.88 12.73,17.5A1.5,1.5 0 0,1 14.23,16H16A5,5 0 0,0 21,11C21,6.58 16.97,3 12,3Z" /></svg>
						</span>
					</div>
				</div>
			</div>
			<?php } ?>
         </div>
		 <div class="pub-footer-bottom">
			<div class="<?php echo Wo_RightToLeft('pull-right');?>">
				<button type="button" onclick="Wo_GetPRecordLink($('#postRecord'))" id="publisher-button" class="btn btn-main">
					<span><?php echo $wo['lang']['post_label']; ?></span>
				</button>
			</div>
			
			<div class="<?php echo Wo_RightToLeft('pull-right');?>"><div class="ball-pulse"><div></div><div></div><div></div></div></div>
			
			<div id="status"></div>
			
			<?php if (!isset($wo['input']['recipient']) && $wo['page'] != 'group') { ?>
			<div class="<?php echo Wo_RightToLeft('pull-left');?>">
				<div class="poster-left-select">
					<div class="publisher-hidden-option inputsm">
						<?php $postprivacyCookie = (!empty($_COOKIE['post_privacy'])) ? $_COOKIE['post_privacy'] : 0;?>
						<select name="postPrivacy" class="form-control inputsm">
							<?php if (empty($wo['page_profile'])) {?>
								<option value="3" <?php echo ($postprivacyCookie == 3) ? ' selected': ''?>><?php echo $wo['lang']['only_me'];?></option>
								<option value="0" <?php echo ($postprivacyCookie == 0) ? ' selected': ''?>><?php echo $wo['lang']['everyone'];?></option>
								<?php if ($wo['config']['connectivitySystem'] == 0) { ?>
								<option value="1" <?php echo ($postprivacyCookie == 1) ? ' selected': ''?>><?php echo $wo['lang']['people_i_follow'];?></option>
								<option value="2" <?php echo ($postprivacyCookie == 2) ? ' selected': ''?>><?php echo $wo['lang']['people_follow_me'];?></option>
								<?php } else {?>
								<option value="1" <?php echo ($postprivacyCookie == 1) ? ' selected': ''?>><?php echo $wo['lang']['my_friends'];?></option>
								<?php }?>
							<?php } else { ?>
								<option value="0" <?php echo ($postprivacyCookie == 0) ? ' selected': ''?>><?php echo $wo['lang']['everyone'];?></option>
								<option value="2" <?php echo ($postprivacyCookie == 2) ? ' selected': ''?>><?php echo $wo['lang']['liked_my_page'];?></option>
							<?php } ?>
						</select>
					</div>
				</div>
			</div>
			<?php } ?>
			
			<div class="<?php echo Wo_RightToLeft('pull-left');?> charsLeft-post"><span id="charsLeft"></span></div>
			
			<div class="clear"></div>
		 </div>
      </div>
   </div>
   <?php if (isset($wo['input']['recipient'])) { ?>
   <input type="hidden" name="recipient_id" value="<?php echo $wo['user_profile']['user_id']; ?>">
   <?php } ?>
   <?php if ($wo['page'] == 'page') {?>
   <input type="hidden" name="page_id" value="<?php echo $wo['page_profile']['page_id']; ?>">
   <?php } else if ($wo['page'] == 'group') {?>
   <input type="hidden" name="group_id" value="<?php echo $wo['group_profile']['id']; ?>">
   <?php } else if ($wo['page'] == 'events') { ?>
   <input type="hidden" name="event_id" value="<?php echo $wo['event']['id']; ?>">
   <?php } ?>
   <input type="hidden" name="hash_id" value="<?php echo Wo_CreateSession();?>">
   <input type="hidden" name="postRecord" value="" id="postRecord">
   <input type="hidden" name="postSticker" value="" id="postSticker" onchange="alert(this.value)">
</form>
<div id="hidden_inputbox"></div>
<?php echo Wo_LoadPage('products/create'); ?>
<script type="text/javascript">
function Wo_ChangeColor(color_1,color_2,text_color,image,id) {
	if (color_1 != '' && color_2 != '' && text_color != '' && id) {
		$('.wo_pub_txtara_combo').css("cssText", "background-image: linear-gradient(45deg, "+color_1+" 0%, "+color_2+" 100%) !important;color: "+text_color+" !important");
		$('#post_color_input').val(id);
		$('.post.publisher-box').addClass('wo_pub_change_color');
	}
	else if(text_color != '' && image != '' && id){
		$('.wo_pub_txtara_combo').css("cssText", "background-position: center !important;background-repeat: no-repeat !important;background-size: cover !important;background-image:url('"+image+"') !important;color: "+text_color+" !important");
		$('#post_color_input').val(id);
		$('.post.publisher-box').addClass('wo_pub_change_color');
	};
}
function Wo_ShowColors() {
	if ($('.all_colors').is(":visible")) {
		$('.all_colors').hide();
		$('#post_color_input').val("");
		$('.post.publisher-box').removeClass('wo_pub_change_color');
	}
	else{
		$('.all_colors').show();
	}
}
function Wo_CloseColor() {
	$('.all_colors').hide();
	$('.wo_pub_txtara_combo').css("cssText", "");
	$('#post_color_input').val("");
	$('.post.publisher-box').removeClass('wo_pub_change_color');
	$(".all_colors_display").removeClass('selected');
}

	var deleted_images = [];
function DeleteImageById(name,id) {
	deleted_images.push(name);
	$('#image_to_'+id).remove();
}

	
$(document).ready(function() {
	$("textarea.postText").keyup(function(){
		if($(this).val().length > 180){
			$('.all_colors').hide();
			$('#post_color_input').val("");
			$('.wo_pub_txtara_combo').css("cssText", "");
			$('.post.publisher-box').removeClass('wo_pub_change_color');
			$(".all_colors_display").removeClass('selected');
		}
		else {
			
		}
	});
	
	$(".all_colors_display").click(function() {
		$(".all_colors_display").removeClass('selected');
		$(this).addClass('selected');
	});
	
	$("#publisher-photos").on('change', function() {
		deleted_images = [];
	//Get count of selected files
	var countFiles = $(this)[0].files.length;
	var imgPath = $(this)[0].value;
	var extn = imgPath.substring(imgPath.lastIndexOf('.') + 1).toLowerCase();
	var image_holder = $("#image-holder");
	image_holder.empty();
	if (extn == "gif" || extn == "png" || extn == "jpg" || extn == "jpeg") {
		if (typeof(FileReader) != "undefined") {
		//loop for each file selected for uploaded.
		for (var i = 0; i < countFiles; i++) 
		{
			var reader = new FileReader();
			var ii = 0;
			reader.onload = function(e) {
				name = "'"+$("#publisher-photos")[0].files[ii].name+"'";
				 image_holder.append('<span class="thumb-image-delete" id="image_to_'+ii+'"><span onclick="DeleteImageById('+name+','+ii+')" class="pointer thumb-image-delete-btn"><svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 24 24"><path fill="currentColor" d="M19,6.41L17.59,5L12,10.59L6.41,5L5,6.41L10.59,12L5,17.59L6.41,19L12,13.41L17.59,19L19,17.59L13.41,12L19,6.41Z" /></svg></span><img src="'+e.target.result+'" class="thumb-image"></span>')
				 ii = ii +1;
				// $("<img />", {
    //                 "src": e.target.result,
    //                 "class": "thumb-image"
    //               }).appendTo(image_holder);
                }
                image_holder.show();
                reader.readAsDataURL($(this)[0].files[i]);
              }
            } else {
              image_holder.html("<p>This browser does not support FileReader.</p>");
            }
         }
	});
});

var fetch_url = 1;
$(function () {
   var allowed = "<?php echo $wo['config']['allowedExtenstion']?>";
  <?php if (!empty($url)) { ?>
    $('textarea').trigger('click');
    setTimeout(function () {
      $('textarea').trigger('keyup')
    }, 1000);
  <?php } ?>
  $('.postText').triggeredAutocomplete({
     hidden: '#hidden_inputbox',
     source: Wo_Ajax_Requests_File() + "?f=mention",
     trigger: "@" 
  });
  <?php if ($wo['config']['maxCharacters'] != 10000) { ?>
  $('.postText').limit("<?php echo $wo['config']['maxCharacters']?>", '#charsLeft');
  <?php } ?>
  $('.emo-form').click(function () {
    $('#emo-form').slideToggle(200);
    Wo_RestFeelings();
  });
  
  $('.gif-form').click(function () {
    $('#gif-form').slideToggle(200);
  });

  $('.map-form').click(function () {
    $('#map-form').slideToggle(200);
	$('#map-form input').focus();
  });
  $('.poll-form').click(function () {
    $('#poll-form').slideToggle(200);
     $('.answers').find('input').each(function (index_id) {
       $(this).val('');
    });
  });
  $("#publisher-file").change(function () {
    var filename = $(this).val().replace(/C:\\fakepath\\/i, '');
    $("#file-form input").val(filename);
    $("#file-form").slideDown(200);
    if (Wo_IsFileAllowedToUpload(filename, allowed) == false) {
      $("#file_not_supported").modal('show');
      Wo_Delay(function(){
        $("#file_not_supported").modal('hide');
      },3000);
      $("#publisher-file").val('');
      $("#file-form input").val('');
      $("#file-form").slideUp(200);
      return false;
    }
  });

  $("#publisher-photos").change(function () {
    var numFiles = this.files.length;
    $("#photo-form input").val(numFiles + ' photo(s) selected');
    $("#photo-form").slideDown(200);
  });

  $("#publisher-video").change(function () {
    var filename = $(this).val().replace(/C:\\fakepath\\/i, '');
    $("#video-form input[type='text']").val(filename);
    $("#video-form").slideDown(200);
    if (Wo_IsFileAllowedToUpload(filename, allowed) == false) {
      $("#file_not_supported").modal('show');
      Wo_Delay(function(){
        $("#file_not_supported").modal('hide');
      },3000);
      $("#publisher-video").val('');
      $("#video-form input[type='text']").val('');
      $("#video-form").slideUp(200);
      return false;
    }
  });

  $("#publisher-music").change(function () {
    var filename = $(this).val().replace(/C:\\fakepath\\/i, '');
    $("#music-form input").val(filename);
    $("#music-form").slideDown(200);
    if (Wo_IsFileAllowedToUpload(filename, allowed) == false) {
      $("#file_not_supported").modal('show');
      Wo_Delay(function(){
        $("#file_not_supported").modal('hide');
      },3000);
      $("#publisher-music").val('');
      $("#music-form input").val('');
      $("#music-form").slideUp(200);
      return false;
    }
  });

  $(document).on("click",".read-ads-description",function(event) {
    var self = $(this);
    self.toggleClass('unsetheight');
  });

  $(document).on('click', '.rads-clicks', function(event) {
    var self  = $(this);
    var ad_id = self.attr('id');
    var url   = self.find('a').attr('href');
    window.open(url, '_blank');
    if (ad_id) {
      $.ajax({
        url: Wo_Ajax_Requests_File() ,
        type: 'GET',
        dataType: 'json',
        data: {f: 'ads',s:'rads-c',ad_id:ad_id},
      })
      .done(function(data) {/*pass*/})
      .fail(function() {/*pass*/});
    }
    event.preventDefault();
  });

  $(document).on('click', '.rvad-clicks', function(event) {
    var self  = $(this);
    self.off("click").removeClass('rvad-clicks');
    var ad_id = self.parent().attr('id');
    var url   = self.find('a').attr('href');
    if (ad_id) {
      $.ajax({
        url: Wo_Ajax_Requests_File() ,
        type: 'GET',
        dataType: 'json',
        data: {f: 'ads',s:'rads-c',ad_id:ad_id},
      })
      .done(function(data) {/*pass*/})
      .fail(function() {/*pass*/});
    }
    event.preventDefault();
  });

  $(document).on('click', '.rvad-views', function(event) {
    var self  = $(this);
    self.off("click").removeClass('rvad-views');
    var ad_id = self.parent().attr('id');
    var url   = self.find('a').attr('href');
    if (ad_id) {
      $.ajax({
        url: Wo_Ajax_Requests_File() ,
        type: 'GET',
        dataType: 'json',
        data: {f: 'ads',s:'rads-v',ad_id:ad_id},
      })
      .done(function(data) {/*pass*/})
      .fail(function() {/*pass*/});
    }
    event.preventDefault();
  });



  <?php if ($wo['config']['video_upload'] == 1) { ?>  
  var thumb_drop_block = $(".thumb-renderer");

  if (typeof(window.FileReader) == 'undefined') {
    thumb_drop_block.find('.preview').text('Drag drop is not supported in your browser!');
  }

  else{
    thumb_drop_block[0].ondragover = function() {
        thumb_drop_block.addClass('hover');
        return false;
    };
        
    thumb_drop_block[0].ondragleave = function() {
        thumb_drop_block.removeClass('hover');
        return false;
    };

    thumb_drop_block[0].ondrop = function(event) {
        event.preventDefault();
        thumb_drop_block.removeClass('hover');
        var file = event.dataTransfer.files;
        $("#post_vthumb_droparea").find('.preview').hide(5, function() {
	      $("#post_vthumb_droparea").find('.image').html($("<img>",{
	        src:window.URL.createObjectURL(file[0])
	      })).show(5);
	    });
        $("#custom-video-thumb").prop('files', file);
    };
  }
  <?php } ?>

  $("#custom-video-thumb").change(function(event) {
    $("#post_vthumb_droparea").find('.preview').hide(5, function() {
      $("#post_vthumb_droparea").find('.image').html($("<img>",{
        src:window.URL.createObjectURL(event.target.files[0])
      })).show(5);
    });
  });

  $(".video-custom-thumb").click(function(event) {
    $(this).find('i').toggleClass('rotate-90d');

    $('.video-poster-image').slideToggle(100,function () {
      var display_stat = $(this).css('display');

      if (display_stat == 'none') {
        $(".video-poster-image").find('.preview').show(10);
        $(".video-poster-image").find('.image').empty().hide(10);
        $("#custom-video-thumb").val('');
      }

    });
  });

  $(document).on('click', '.rads-views', function(event) {
    var self  = $(this);
    var ad_id = self.attr('id');
    var url   = self.find('a').attr('href');
    window.open(url, '_blank');
    if (ad_id) {
      $.ajax({
        url: Wo_Ajax_Requests_File() ,
        type: 'GET',
        dataType: 'json',
        data: {f: 'ads',s:'rads-v',ad_id:ad_id},
      })
      .done(/* pass */)
      .fail(/* pass */)
    }
    event.preventDefault();
  });

  var bar = $('#bar');
  var percent = $('#percent');
  var status = $('#status');
  var publisher_button = $('#publisher-button');

  $('form.post').ajaxForm({
    url: Wo_Ajax_Requests_File() + '?f=posts&s=insert_new_post',
    beforeSend: function () {
      var percentVal = '0%';
      bar.width(percentVal);
      percent.html(percentVal);
   //    publisher_button.attr('disabled', true);
   //    publisher_button.css('color', '#333');
	  // $('#publisher-box-focus .pub-footer-bottom').find('.ball-pulse').fadeIn(100);
    },
    uploadProgress: function (event, position, total, percentComplete) {
      var percentVal = percentComplete + '%';
      bar.width(percentVal);
      $('#progress').slideDown(200);
      percent.html(percentVal);
    },beforeSubmit: function (a,b,c) {
    	for (var i = 0 ;i < a.length ; i++) {
    		if (a[i].name == 'postPhotos[]') {
    			for (var b = 0 ;b < deleted_images.length ; b++) {
    				if (a[i].value.name == deleted_images[b]) {
    					a[i] = {name:'',value:''};
    				}
    			}
    		}
    	}
    	deleted_images = [];
    	
    },
    success: function (data) {
      $('#post_color_input').val("");
      $('.all_colors').hide();
	  $('.wo_pub_txtara_combo').css("cssText", "");
	  $('.postText').css("cssText", "");
	  $('.post.publisher-box').removeClass('wo_pub_change_color');
      $('#progress').slideUp(200);
      publisher_button.attr('disabled', false);
      publisher_button.css('color', '#fff');
      percent.removeClass('white');
      $('.postText').css('height', 'auto');
      $("#postRecord").val('');
      $("#postSticker").val('');
      if(data.status == 200) {
      	$('#user_post_count').text(data.post_count);

        if(data.html.length > 0) {
          $('#posts, #posts_hashtag').find('.posts-container').remove();
        }
        $('#posts, #posts_hashtag').prepend(data.html);
        $('#video-form, #emo-form, #music-form, #map-form, #file-form, #photo-form, #album-form, .feeling-type, #poll-form, #gif-form').slideUp(200);
        $(".video-poster-image").hide(10, function() {
          $(this).find('.preview').show(10);
          $(this).find('.image').empty().hide(10);
          $(".video-custom-thumb").find('i').removeClass('rotate-90d');
        });
		$("body").removeClass('pub-focus');
        Wo_RemoveFetchedUrl();
		Wo_HidePosInfo();
        $('form.post').clearForm();
        $('.feelings-value').html('');
        $('#postSticker').html('');
        $('select').prop('selectedIndex', 1);
        <?php if ($wo['config']['maxCharacters'] != 10000) { ?>
        $('#charsLeft').text("<?php echo $wo['config']['maxCharacters']?>");
        <?php } ?>
        <?php if (!empty($url)) { ?>
        window.close();
        <?php } ?>
        if (data.invalid_file == 1) {
          $("#invalid_file").modal('show');
          Wo_Delay(function(){
            $("#invalid_file").modal('hide');
          },3000);
        }
        else if(data.invalid_file == 2){
          $("#file_not_supported").modal('show');
          Wo_Delay(function(){
            $("#file_not_supported").modal('hide');
          },3000);
        }
        else if(data.invalid_file == 3){
          $("#adult_image_file").modal('show');
          Wo_Delay(function(){
            $("#adult_image_file").modal('hide');
          },3000);
        }
      } 
      else if (data.status == 400) {
        if (data.invalid_file == 1) {
          $("#invalid_file").modal('show');
          Wo_Delay(function(){
            $("#invalid_file").modal('hide');
          },3000);
        }
        else if(data.invalid_file == 2){
          $("#file_not_supported").modal('show');
          Wo_Delay(function(){
            $("#file_not_supported").modal('hide');
          },3000);
        }
        else if(data.invalid_file == 3){
          $("#adult_image_file").modal('show');
          Wo_Delay(function(){
            $("#adult_image_file").modal('hide');
          },3000);
        }
        else{
         // alert('Foramt is not supported, please try again later');
        }
      } 
      fetch_url = 1;
      $('#publisher-box-focus .pub-footer-bottom').find('.ball-pulse').fadeOut(100);
    }
  });

  <?php if ($wo['config']['google_map']) { ?>
  var pac_input = document.getElementById('searchTextField');
  (function pacSelectFirst(input) {
    // store the original event binding function
    var _addEventListener = (input.addEventListener) ? input.addEventListener : input.attachEvent;
    function addEventListenerWrapper(type, listener) {
      // Simulate a 'down arrow' keypress on hitting 'return' when no pac suggestion is selected,
      // and then trigger the original listener.
      if(type == "keydown") {
        var orig_listener = listener;
        listener = function (event) {
          var suggestion_selected = $(".pac-item-selected").length > 0;
          if(event.which == 13 && !suggestion_selected) {
            var simulated_downarrow = $.Event("keydown", {
              keyCode: 40,
              which: 40
            });
            orig_listener.apply(input, [simulated_downarrow]);
          }
          orig_listener.apply(input, [event]);
        };
      }
      // add the modified listener
      _addEventListener.apply(input, [type, listener]);
    }
    if(input.addEventListener)
      input.addEventListener = addEventListenerWrapper;
    else if(input.attachEvent)
      input.attachEvent = addEventListenerWrapper;
  })(pac_input);

  $(function () {
     var autocomplete = new google.maps.places.Autocomplete(pac_input);
  });
  <?php } ?>

  var getUrl  = $('.form-control.postText'); //url to extract from text field
  var sent = 0;
  $('.form-control.postText').bind("paste keyup input propertychange", function(e) {    
    // if ($(this).val() == '') {
    //     fetch_url = 1;
    //  }
    if (($(".extracted_url").length > 0)){
      return false;
    }

    else if (/(https?:\/\/(?:.*)\.(?:png|jpg|gif|jpeg))/ig.test(getUrl.val())) {
      /* pass */
    }

    else{
    	
      var match_url = /(https?:\/\/[^\s]+)/g;
      if (match_url.test(getUrl.val()) && sent == 0 && fetch_url == 1) {

      	  sent = 1;

          $("#results").hide();
          $("#loading_indicator").show(); 
          var extracted_url = getUrl.val().match(match_url)[0];

          $.post(Wo_Ajax_Requests_File() + '?f=posts&s=fetch_url',{'url': extracted_url}, function(data){         
            extracted_images = data.images;
            total_images     = parseInt(data.images.length-1);
            img_arr_pos      = total_images;
            if(extracted_images != ''){
              inc_image   = '<div class="extracted_thumb" id="extracted_thumb"><img src="'+data.images[img_arr_pos]+'"></div>';
              input_image = data.images[img_arr_pos];
            } 

            else {
              inc_image   = '';
              input_image = '';
            }
            
            var img_content = '';
            if (total_images > 1) {
              img_content = '<div class="thumb_select"><div class="thumb_sel"><span class="prev_thumb" id="thumb_next"><i class="fa fa-arrow-circle-right"></i></span><span class="next_thumb" id="thumb_prev"><i class="fa fa-arrow-circle-left"></i></span> </div><span class="small_text" id="total_imgs">'+img_arr_pos+' of '+total_images+'</span></div></div></div>';
            }

            var content = '<div class="extracted_url"><span class="remove-fetched-url" onclick="Wo_RemoveFetchedUrl();"><i class="fa fa-remove"></i></span>'+ inc_image +'<div class="extracted_content"><input class="form-control url-input" type="text" name="url_title" value="'+data.title+'" dir="auto"><br><textarea onkeyup="textAreaAdjust(this, 70)" class="form-control url-input-textarea url-input" name="url_content" placeholder="<?php echo $wo['lang']['description']?>" dir="auto">' + data.content + '</textarea><input type="hidden" id="url_image" name="url_image" value="'+ input_image +'"><input type="hidden" id="url_link" name="url_link" value="'+data.url+'"><div class="clear"></div>' + img_content;

            $("#results").html(content); 
            $("#results").fadeIn(); 
            $("#loading_indicator").hide();
            sent = 0;

          },'json');
      }
    }
  });


  
  $("body").on("click","#thumb_prev", function(e){    
    if(img_arr_pos>0) 
    {
      img_arr_pos--; 
      
      $("#extracted_thumb").html('<img src="'+extracted_images[img_arr_pos]+'">');

      $("#url_image").attr('value', extracted_images[img_arr_pos]);
      
      $("#total_imgs").html((img_arr_pos) +' of '+ total_images);
    }
  });
  
  $("body").on("click","#thumb_next", function(e){    
    if(img_arr_pos<total_images)
    {
      img_arr_pos++;
      
      $("#extracted_thumb").html('<img src="'+extracted_images[img_arr_pos]+'">');

      $("#url_image").attr('value', extracted_images[img_arr_pos]);
      
      $("#total_imgs").html((img_arr_pos) +' of '+ total_images);
    }
  });

});



function Wo_RemoveFetchedUrl() {
  fetch_url = 0;
  var content = $('form.publisher-box').find('.extracted_url');
  content.slideUp(function () {
    $(this).remove();
    if ($('.form-control.postText').val() != '') {
    	$('.form-control.postText').focus();
    }
    
    
  });
}

function Wo_OpenAlbum() {
  $('#album-form').slideToggle(100);
  $('#album-form input').focus();
}
function Wo_ShowFeelings() {
  if ($('.feelings-type-to').is(':empty')) {
    $('.feeling-types').slideToggle(200);
  }
}
var pac_input2 = document.getElementById('feelings-text');
function Wo_ShowFeelingType(type, text, placeholder, icon) {
  $('.feeling-types').slideUp(200, function () {
    $('.feelings-type-to').html(text);
    $('#feelings-text').attr('placeholder', decodeHtml(placeholder)).focus();
    $('#feeling-type').val(type);
    if (type != 'feelings') {
      $('#feelings-text').attr('readonly', false);
    }
    <?php if ($wo['config']['google_map']) { ?>
    if (type == 'traveling') {
      var autocomplete = new google.maps.places.Autocomplete(pac_input2);
    } else {
      google.maps.event.clearInstanceListeners(pac_input2);
    }
    <?php } ?>
    $('.' + type).slideToggle(200);
  });
}
function Wo_RestFeelings() {
  $('.feelings-type-to, .feelings-value').empty();
  $('#feelings-text').val('');
  $('#feelings-text').attr('readonly', true);
  $('#feelings-text').attr('placeholder', decodeHtml("<?php echo $wo["lang"]["feel_d"]?>"));
  $('.feeling-type, .feelings-type').slideUp(200);
  <?php if ($wo['config']['google_map']) { ?>
  google.maps.event.clearInstanceListeners(pac_input2);
  <?php } ?>
  Wo_ShowFeelings();
}

function Wo_AddFeeling(type, text, icon) {
  $('#feelings-text').val(type);
  $('.feelings-value').html('<span><i class="twa-lg twa twa-' + icon + '"></i> ' + text + '</span>')
  Wo_ShowFeelingType('feelings', 'Feeling', 'What are you feeling ?', 'smile-o');
}
function smokeTheAt(str) {
  var n = str.search("@");
  if(n != "-1"){
    alert('sd');
  }
}

function Wo_AddAnswer() {
  answer_id = 0;
  $('.answers').find('input').each(function (index_id) {
     answer_id = Number(index_id) + 1;
  });
  var last_answer_id = (Number(answer_id) + 1);
  if (last_answer_id < 9) {
     $('.answers').append('<input name="answer[]" type="text" class="form-control" placeholder="<?php echo $wo['lang']['answer'] ?> ' + last_answer_id + '">');
     if (last_answer_id == 8) {
      $('#add_answer').hide();
     }
     $('.answers').find('input:last').focus();
  } else {
     $('#add_answer').hide();
  }
  
}

function Wo_HidePosInfo() {
  $(".postText").attr('opened', '0');
  $(".postText").css('height', '55px');
  $(".publisher-box-footer").slideUp(100);
  $(".camera-button").removeClass('hiddencamera');
  fetch_url = 1;
}
function Wo_ShowPosInfo() {
  $(".postText").attr('opened', '1');
  $(".postText").css('height', '75px');
  $(".publisher-box-footer").slideDown(100);
  $(".camera-button").addClass('hiddencamera');
}
$(document).on('focus', '#publisher-box-focus',function(){
	$("body").addClass('pub-focus');
	if(navigator.userAgent.toLowerCase().indexOf('firefox') > -1){
	    $(".publisher-box-footer").slideDown(100);
  		$(".camera-button").addClass('hiddencamera');
  		$(".postText").attr('opened', '1');
	}
});
$('#focus-overlay').on('click',function (){
    $("body").removeClass('pub-focus');
	Wo_HidePosInfo();
	$('.all_colors').hide();
	$('.wo_pub_txtara_combo').css("cssText", "");
	$('.postText').css("cssText", "");
	$('#post_color_input').val("");
	$('.post.publisher-box').removeClass('wo_pub_change_color');
	$(".all_colors_display").removeClass('selected');
});
// $(function() {
  // $(window).scroll(function() {
    // var scrollfocus = $(window).scrollTop();
    // if (scrollfocus >= 500) {
      // $("body").removeClass('pub-focus');
    // }
  // });
// });
function Wo_ResetAnswers() {
  $('.answers').find('input').each(function (index_id) {
     $(this).val('');
  });
  $('#poll-form').slideUp(200);
}
function Wo_PostSticker(self){
  if (!self) {
    return false;
  }
  $('#postSticker').val($(self).attr('data-gif'));
  Wo_Delay(function(){
     Wo_GetPRecordLink();
  },500)
}
function Wo_GetPostStickers(keyword){
  if (!keyword) {
    //return false;
  }
  $('#publisher-box-stickers').find('.ball-pulse').fadeIn(100);
  Wo_Delay(function(){
    $.ajax({
      url: 'https://api.giphy.com/v1/gifs/search?',
      type: 'GET',
      dataType: 'json',
      data: {q:keyword,api_key:'<?php echo $wo['config']['giphy_api'];?>', limit: 20},
    })
    .done(function(data) {
      if (data.meta.status == 200 && data.data.length > 0) {
        $('#publisher-box-stickers-cont').empty();
        var appended = false;
        for (var i = 0; i < data.data.length; i++) {
            appended = true;
            if (appended == true) {
              appended = false;
              $('#publisher-box-stickers-cont').append($('<img alt="gif" src="'+data.data[i].images.fixed_height_small.url+'" data-gif="' + data.data[i].images.fixed_height.url + '" onclick="Wo_PostSticker(this)" autoplay loop>'));
              appended = true;
            }
        }
        var images = 0;
        Wo_ElementLoad($('img[alt=gif]'), function(){
          images++;
        });
        if (data.data.length == images || images >= 5) {
          $('#publisher-box-stickers').find('.ball-pulse').fadeOut(100);
        }
      }
      else{
        $('#publisher-box-stickers-cont').html('<p class="no_gifs_found"><i class="fa fa-frown-o"></i> <?php echo $wo['lang']['no_result']; ?></p>');
      }
    })
    .fail(function() {
      console.log("error");
    })
  },100);
}
</script>