Instagram弹出窗口(Instagram popup)
情况
我正在使用instafeed插件根据标签从Instagram加载一些图像。 暴跌运作良好。 每次点击Instagram图片我想在我的网站窗口打开一个灯箱,图片,标题,用户名等......
var allTagFeed = new Instafeed({ target: 'instpop', get: 'tagged', tagName: 'mongolia', clientId:'xxxxxxxxxxxx', accessToken: 'xxxxxxxxxx', limit:'2', template: '<div id="caption">{{caption}} </div><div id="bg"><a href="{{link}}" target="_blank"><img src="{{image}}" /></a>{{likes}}</div>' });
解决方案
创建一个调用该特定用户信息的函数,以便将其放入模板中。
问题
我不知道如何创建该功能。 我还想询问是否有人知道另一种方式将Instagram图片与其信息(就像instagram.com一样)包含在一个单独的弹出窗口中,因为我不希望用户离开我的页面。
The situation
I am using instafeed plugin to load some images from Instagram according to a hashtag. The plunging is working well. Every time a Instagram image is clicked I want to open a light-box in my website window With the image, caption, user name, etc...
var allTagFeed = new Instafeed({ target: 'instpop', get: 'tagged', tagName: 'mongolia', clientId:'xxxxxxxxxxxx', accessToken: 'xxxxxxxxxx', limit:'2', template: '<div id="caption">{{caption}} </div><div id="bg"><a href="{{link}}" target="_blank"><img src="{{image}}" /></a>{{likes}}</div>' });
The solution
Create a function that call that specific user information, so I can put it into a template.
The problem
I don't know how to create that function. I also want to ask if someone knows another way to include Instagram picture with it's information (just like instagram.com) in a separated pop up as I don't want the user goes out of my page.
原文:https://stackoverflow.com/questions/34222736
最满意答案
您在询问编写命令行程序。 这里只是一个简单的:
#!/usr/bin/env bash if [[ $# -eq 0 ]]; then echo "no command specified" exit elif [[ $# -gt 1 ]]; then echo "only one argument expected" exit fi case "$1" in test) echo "hello, this is test1" ;; test2) echo "hello, this is test2" ;; *) echo "unknown command: $1" ;; esac
然后通过运行
chmod +x script.sh
保存它并使其成为可执行文件,并在.bashrc
文件中添加alias personal="/fullpath/to/the/script.sh"
。这是使用
bash
非常基本和简单的示例,当然您可以使用任何您喜欢的语言,例如Python,Ruby,Node等You are asking about writing a command-line program. Just a simple one here:
#!/usr/bin/env bash if [[ $# -eq 0 ]]; then echo "no command specified" exit elif [[ $# -gt 1 ]]; then echo "only one argument expected" exit fi case "$1" in test) echo "hello, this is test1" ;; test2) echo "hello, this is test2" ;; *) echo "unknown command: $1" ;; esac
Then save it and make it an executable by run
chmod +x script.sh
, and in your.bashrc
file, addalias personal="/fullpath/to/the/script.sh"
.This is just very basic and simple example using
bash
and of course you can use any language you like, e.g. Python, Ruby, Node e.t.c.
相关问答
更多-
你在寻找一种方法来检测它是什么类型的终端? 尝试: echo $TERM 维基百科 : TERM(类Unix) - 指定正在使用的计算机终端或终端仿真器的类型(例如,vt100或dumb)。 另请参阅: 终端仿真器列表 Are you looking for a way to detect what type of terminal it is? Try: echo $TERM From Wikipedia: TERM (Unix-like) - specifies the type of comput ...
-
下列中不属于面向对象的编程语言的是?[2022-05-30]
a -
您在询问编写命令行程序。 这里只是一个简单的: #!/usr/bin/env bash if [[ $# -eq 0 ]]; then echo "no command specified" exit elif [[ $# -gt 1 ]]; then echo "only one argument expected" exit fi case "$1" in test) echo "hello, this is test1" ;; test2) echo ...
-
你可以使用screen / tmux来做这种事情。 tmux示例: tmux new-session 'script1 param1' \; split-window 'script2 param2' Tmux将在拆分窗口中打开两个终端,并在同一时间运行脚本。 如果你需要运行更多的脚本,只需添加另一个\; split-window 'script param' \; split-window 'script param' 。 如果您需要从启动脚本或cron运行它,可以运行它分离: tmux new-ses ...
-
使用iTerm获得加载点文件时,需要在这里发生两件事情。 首先,您应该将以下内容添加到.bash_profile [[ -s ~/.bashrc ]] && source ~/.bashrc 其次,您需要确保在iTerm首选项中您的终端设置为启动登录shell。 希望这可以帮助! Two things need to happen here when using iTerm to get the loading of dotfiles to work. First you should add the f ...
-
严格地说,您无法判断用户在单击脚本后是否选择了“Run In Terminal”,或者启动终端并从那里运行脚本。 但是下面的命令可以帮助你,特别是[ -t 2 ] 。 if [ -t 1 ]; then echo "Standard output is a terminal." echo "This means a terminal is available, and the user did not redirect the script's output." fi if [ -t 2 ]; t ...
-
是否可以获取在父终端中运行的最后一个命令?(Is it possible to fetch the last command ran in a parent terminal?)[2022-02-18]
如此处建议您可以将新命令保存到具有history -a的文件中,然后在子进程中可以读取文件中的最后N行(使用tail -n )。 As suggested here you can save the new commands to a file with history -a , then in the child process you can read the last N lines from the file (with tail -n ) ... -
我知道你想要一个运行bash作为主要进程的所有终端的列表并在其中运行ipython吗? 然后我认为你的正则表达式匹配错误的东西,因为使用grep而不是egrep。 无论如何,我做了以下事情: pgrep bash | xargs -n1 pstree -p -c | egrep "^(bash|.*[{]?ipython[}]?)\\([0-9]+\\)$" | cut -d\( -f2 | cut -d\) -f1 为了只实现没有子进程的bash进程,我从开始标志(^)添加了一个匹配,因为ipython ...
-
Bash溢出终端(Bash overfill terminal)[2020-12-12]
您可以尝试以下任何一种方法(使用ls命令作为命令所在位置的示例): 选项A:使用>将输出重定向到文件,然后使用less或文本编辑器(如vim或gedit检查文件。 $ ls > outfile $ less outfile $ vim outfile $ gedit outfile $ emacs outfile 要将命令的输出写入stdout和stderr到你的outfile ,最后添加一个2>&1 ,如下所示: $ ls > outfile 2>&1 选项B:将命令的输出直接传递给less $ ls ... -
Bash终端 - .profile不会在终端中调用某些功能(Bash Terminal - .profile does not call some functions in terminal)[2022-03-12]
答案分为两部分: @barmar指出这个错误消息在-bash: npm: command not found npm -bash: npm: command not found之前有一个空格,并且有一个不可见的空间需要删除。 Load RVM into a shell session *as a function*应该是注释,因此它缺少# 。 这两件事固定了我的.profile The answer was two parts: @barmar pointed out that this error mes ...